Answer the question
In order to leave comments, you need to log in
How to display the number of comments without text ("comments") in a WordPress template using standard methods?
In my template, each article should display the number of comments. I deduced according to the instructions using comments_popup_link(); . Yes, it displays comments, but as I understand it, only with text ("1 comment") . In my case, I need to display only the number of comments, without the following text.
There is such a way: get_comments_number(); , but it says something about notifications and pings.
Therefore, I want to learn from knowledgeable people how to display the number of comments correctly.
Answer the question
In order to leave comments, you need to log in
<?php comments_number($zero, $one, $more); ?>
$zero - the text that will be shown if there are no comments.
$one - if there is only 1 comment.
$more - if there are more than 1 comments.
If you only need the number of comments as a digit:
<?php comments_number('0', '1', '%'); ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question