Displays the language string for the number of comments the current post has.
Parameters
Source
function comments_number( $zero = false, $one = false, $more = false, $post = 0 ) {
echo get_comments_number_text( $zero, $one, $more, $post );
}
Displays the language string for the number of comments the current post has.
function comments_number( $zero = false, $one = false, $more = false, $post = 0 ) {
echo get_comments_number_text( $zero, $one, $more, $post );
}
You must log in before being able to contribute a note or feedback.
Text Response to Number of Comments
Displays text based upon number of comments: Comment count zero – no responses; comment count one – one response; more than one comment (total 42) displays 42 responses.
Title For Comments Section
You might want to have a title above your comments section that includes the number of comments. This example shows how to do that and have all the strings also be translatable.
Usage of ‘comments_number’ filter
_n()
can simplify the above function definition to one line: