April 2, 2009

How to Number Your Comments

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

Previous Post and Next Post

Try HostGator Webhosting for 1 cent for the 1st Month Click here and enter "wordpress"

Leave a reply

* means field is required.