DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

Do your blog posts receive lots of comments? If yes, it can be really useful for both you and your readers to number it. Here’s how to do it easily and efficiently.

Open comments.php and find the following line:

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

Just above this line, initialize a counter variable:

<?php $i = 0; ?>

Just after this line, increment the counter:

<?php $i++; ?>

Now, you just have to echo the $i variable to get the number of the current comment. Paste this code anywhere on your comments loop:

<?php echo $i; ?>

Your comments are now numbered!

One Comment

  1. Hi, thanks for this post.
    I can’t seem to be able to find the comments.php
    Is it my theme, or am I missing something? lol..sorry but seems either many restrictions or I’m just not getting it. thanks!

Leave a Comment

Your email address will not be published. Required fields are marked *