How to stop ‘No Comments’ being displayed
-
Hello. I originally posted this question (copied below) over a year ago but never got around to implementing the solution. I just tried it today but could not locate the file content-postmeta anywhere in the WordPress directory. There have been several big WordPress updates since I originally asked this question: has the name of this file been changed? Please advise which file I need to look at, and also can you please confirm that the solution below would still work?
Thanks
ORIGINAL QUESTION
Hi, with reference to the original question, I’d like to remove the text ‘No Comments’ from the metadata using a rule that stops this displaying if there are no comments. If there are comments, I’d still like it to display (i.e. if there is a comment, it will say ‘1 Comment’ as normal). Basically, I don’t want to advertise the fact that there are no comments!I’ve been experimenting with variations on this basic rule:
if ( comments_open() ) {
if ( $num_comments == 0 ) {
$comments = __(‘No Comments’);
}…but I can’t get it to work. I keep breaking it. My php Fu is not strong ??
ORIGINAL ANSWER
Theme Author Guido(@guido07111975)
1 year, 7 months ago
Hi,
Guess this will work (not tested yet), open file content-postmeta and look for:
<?php comments_popup_link( __( ‘No comments’, ‘simplyblack’ ), __( ‘1 comment’, ‘simplyblack’ ), __( ‘% comments’, ‘simplyblack’ ) ); ?>
Just remove the “No comments” text:
<?php comments_popup_link( __( ”, ‘simplyblack’ ), __( ‘1 comment’, ‘simplyblack’ ), __( ‘% comments’, ‘simplyblack’ ) ); ?>
Guido
The page I need help with: [log in to see the link]
- The topic ‘How to stop ‘No Comments’ being displayed’ is closed to new replies.