WordPress:Template Tags/comments number
来自站长百科
Description
Displays the total number of comments, Trackbacks, and Pingbacks for a post. This tag must be within WordPress:The Loop.
Usage
%%% <?php comments_number('zero', 'one', 'more'); ?> %%%
Examples
Text Response to Number of Comments
Displays text based upon number of comments: Comment count zero - no reponses; comment count one - one response; more than one comment (total 42) displays 42 responses.
<p>This post currently has <?php comments_number('no responses','one response','% responses'); ?>.</p>
Parameters
- zero
- (string) Text to display when there are no comments. Defaults to 'No Comments'.
- one
- (string) Text to display when there is one comment. Defaults to '1 Comment'.
- more
- (string) Text to display when there is more than one comment. % is replaced by the number of comments, so '% so far' is displayed as "5 so far" when there are five comments. Defaults to '% Comments'.