WordPress:Template Tags/comments number

来自站长百科
Xxf3325讨论 | 贡献2008年6月25日 (三) 10:58的版本 (新页面: == Description == Displays the total number of comments, Trackbacks, and Pingbacks for a post. This tag must be within [[...)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航、​ 搜索

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'.

Related

模板:Tag Comments Tags

模板:PHP Function Tag Footer