php - How to include comments under posts in a clean build template? -


i new wordpress theme development , building building first 1 scratch, have hit issue adding comments blog posts.

i have loop returns each post:

<div class="eachpost"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <h1><?php the_title(); ?></h1> <article <?php post_class(); ?> id="post-<?php the_id(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="permanent link <?php the_title_attribute(); ?>"><?php the_title();?></a></h2>  <p class="entry-meta">by <?php the_author_meta('first_name'); ?> <?php the_author_meta('last_name'); ?> in <?php the_category(", ") ?></p> <p class='right'><a class='comments-count' href='<?php the_permalink() ?>'><?php comments_number('0', '1', '%') ?></a></p> <?php comments_template(); ?> </article> <h4>posted on <?php the_time('f js, y') ?></h4> <p><?php the_content(__('(more...)')); ?></p> <hr> <?php endwhile; else: ?> <p><?php _e('sorry, no posts matched criteria.'); ?></p><?php endif; ?> </div> 

i believe need call function:

<?php comments_template(); ?> 

but adding code has no effect.

i have comments.php , comment-template.php in same folder file , believe need include these in page follows

<?php get_template_part('comments.php'); ?> <?php get_template_part('comments_template.php'); ?> 

using in config

<?php define('wp_debug', true);?> <?php define('wp_debug_log', true);?> <?php define('wp_debug_display', true);?> 

create no error in logs or info.

in clean build template how include comments under posts?

the comments.php needs inside template root folder, please take @ wordpress codex http://codex.wordpress.org/function_reference/comments_template

if want have somewhere else, here's wordpress recommendation:

the path file used alternative comments template should relative current theme root directory, , include subfolders. if custom comments template in folder inside theme, may when called:

<?php comments_template( '/custom-templates/alternative-comments.php' ); ?>  

you see no errors because there's no mistake there. system calling function should load file if doesn't exist, no error thrown.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -