Counting comments of previous posts
I’m attempting to include the title, excerpt, date, and comment count of the previous five posts. The code I’m using is:
<?php $posts = get_posts('numberposts=5&offset=1&category=1'); foreach($posts as $post) :?>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php the_excerpt(); ?>
<p class="postdate"><?php the_time('d/m/Y') ?>
<p class="comments"><?php comments_popup_link('0 comments', '1 comment', '% comments'); ?>
<?php endforeach; ?>
Everything displays perfectly, except the comment count of the individual posts (each show zero) even though the comment link works. Any ideas on how to correct?
- The topic ‘Counting comments of previous posts’ is closed to new replies.