I wanted to show the comments for each post on the index page but, after reading the codex and some posts on the forums, I really can’t work out how to make it work.
For what I have read on the codex, a call to comments_template() inside the Loop should be enough to display the comments for each post, but this simply does nothing. Including the comments.php template directly results in the textarea for new comments being displayed, but again without showing the comments.
I’m using the default template for WP1.5 for my tests:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h2 id="post-<?php the_ID(); ?>">" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></h2>
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
<?php the_content('Read the rest of this entry »'); ?>
<p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit','','|'); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
<!-- ***** Comments should be displayed here: ***** -->
<?php comments_template(); ?>
<?php trackback_rdf(); ?>
<?php endwhile; ?>
I’ve been staring at the code for quite a while now, but still I can’t seem to make it work… any clues?
- The topic ‘comments_template() doesn’t work on index in WP1.5’ is closed to new replies.