Custom PHP and CSS to make ‘No Comments’ different to ‘ X Comments’

  • Author
  • #366283


    It’s the small things that count. There is no identifier between posts with a ‘no comments’ link or ‘multiple (%) comments’ link. I think posts with comments should attract MORE attention, but it depends on your needs.

    Note: You need to know PHP and CSS code to do this.

    You can modify the code of <p class=”postmetadata”> in archive.php and index.php in your template folder to get the desired results. As far as I can tell, the above are the only 2 files that need to be changed. Not a core change at all.


    1. Make a backup of any template file you work on (best practice)
    2. Open up archive.php (or index.php) in your template folder and look for the <div> “postmetadata”
    3. Find: 'No Comments »'
    4. Replace with '<span class="noComments">No Comments »</span>'
    5. Upload and check your outputted HTML source code, and ensure that the <span> wraps the ‘No Comments’ link text
    6. In style.css in your template dir, now make a new class called ‘span.noComments’
    7. Give it a custom colour to test it out

    Now, posts with no comments will have a different colour for the “No Comments” link. You can now do a lot in CSS and PHP to trick out the comment links.

    Please let me know if you struggle. Please, always back up files when testing things out.




    You did not specify a blog address or reason for posting when you created this topic.

    This support forum is for hosted blogs only. If you have a self-hosted WordPress blog you need to seek help at the forums, not here.

    If you don’t understand the difference, you may find this information helpful.



    Delete this post, i’ve backed it up.

    Ta for reply, good work on dev

The topic ‘Custom PHP and CSS to make ‘No Comments’ different to ‘ X Comments’’ is closed to new replies.