WordPress.org

Ready to get started?Download WordPress

Forums

Custom PHP and CSS to make 'No Comments' different to ' X Comments' (1 post)

  1. codinedawn
    Member
    Posted 5 years ago #

    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.

    Steps:

    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.

    A*

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 5 years ago by codinedawn
  • This topic is not a support question
  • WordPress version: 2.7.1