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*
The topic ‘Custom PHP and CSS to make ‘No Comments’ different to ‘ X Comments’’ is closed to new replies.
(@codinedawn)
14 years, 11 months 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*