Numbering Comments in WordPress

by Reeze on April 20, 2009

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++; ?>

So, your code will look like this

<?php $i = 0; ?>
<?php foreach ($comments as $comment) : ?>
<?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!

Feel free to ask Help !

Related posts:

  1. Numbering comments in blogger
  2. Webaddict-Reinvented – Premium WordPress Theme

Leave a Comment

Previous post:

Next post: