How to Number Your Comments

By | April 2, 2009

Lets say you have a fairly popular blog, but you want to follow the discussions that go on in the comments section. Instead of depending on that small avatar to find where you posted, here is an easy way to number all of the comments made on a post. I have included this on my blogs, and it has been very well accepted by readers and users. Here’s how we will achieve this simple hack:

Open up your comments.php file, and find this line:

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

Then, put this code above what you just found:

<?php $i = 0; ?>
<?php $i++; ?>

It’s as simple as that. As far as I know this works with the new threaded commenting system in WordPress 2.7+, but if you have any problems, please leave a comment and I’ll see if I can fix it.

Thanks to Pro Blog Tutorials for this simple hack
Category: Uncategorized