Just a quick one to tidy up your blog a little and make it a little less negative! It’s quite common to see a list of posts on a WordPress blog with meta info underneath each one displaying things like Post Time, Post Category, Author and the number of Comments the article has. For smaller blogs, there probably wont be too many comments left so you’ll see “No Comments” or “0 Comments” under a lot of the posts. I’ve always thought this looked a little sad on my own blog. Like, here I am slaving away on these excellent and informative articles and no one is reading or commenting on them!? Here’s a quick code edit to hide the “No Comments” text if there are none but show the number of comments and link to them if there are any.
Open the index.php file for your theme in a HTML editor and look for a line similar to this:
<?php comments_popup_link(‘0 Comments’, ‘1 Comment’, ‘% Comments ‘); ?>
Change this to:
<?php comments_popup_link(”, ‘1 Comment’, ‘% Comments ‘); ?>
You’re just deleting any text that should be displayed when there are no comments so if there are none, then nothing will be shown. Geddit!?
You might need to edit this line in several other template files also such as Archive.php, Category.php, Search.php, Tag.php and anywhere else comment numbers are displayed.