Support » Themes and Templates » Count comments for each post

Viewing 4 replies - 1 through 4 (of 4 total)
  • I’m a little confused by your request, but I assume from the link you provided you’re just trying to display ascending numbers beside each comment.

    The simplest method is to count off comments with your own variable, and use that to display the #. In commments.php (of your theme — if it doesn’t have one, it will use the one for the default theme), look for this bit of code:

    <?php foreach ($comments as $comment) : ?>

    Just after the foreach, insert your variable with an increment operator:

    <?php foreach ($comments as $comment) : $comment_count++; ?>

    Then where you want your number to display:

    <?php echo $comment_count; ?>

    YESSS! It works.
    That’s exactly what i wanted! 🙂
    I dind’t mean to confuse you but my English is not the best when it come sto technical terms. :/

    Thanks a lot!!

    Don’t sweat over the tech language. I hate not fully understanding the question being asked, but I’m glad I assumed correct. :)

    Me too 😉

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Count comments for each post’ is closed to new replies.