Counting comments of previous posts (1 post)

  1. WilliamHamby
    Posted 9 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic