WordPress函数文档comments_number()

显示当前文章的评论数量 描述 Displays the total number of comments, T…

显示当前文章的评论数量

描述

Displays the total number of comments, Trackbacks, and Pingbacks for the current post. This tag must be within The Loop.

Use get_comments_number() to retrieve the value.

用法

 <?php comments_number$zero$one$more ); ?> 

参数

$zero

(string) (可选) Text to display when there are no comments.

默认值: ‘No Comments’

$one

(string) (可选) Text to display when there is one comment.

默认值: ‘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.

默认值: ‘% Comments’

示例

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.

历史

添加于 版本: 0.71

源文件

comments_number() 函数的代码位于 wp-includes/comment-template.php

相关

Comments Function(函数)s

  • Function(函数): cancel_comment_reply_link()
  • Function(函数): comment_author()
  • Function(函数): comment_author_email()
  • Function(函数): comment_author_email_link()
  • Function(函数): comment_author_IP()
  • Function(函数): comment_author_link()
  • Function(函数): comment_author_rss()
  • Function(函数): comment_author_url()
  • Function(函数): comment_author_url_link()
  • Function(函数): comment_class()
  • Function(函数): comment_date()
  • Function(函数): comment_excerpt()
  • Function(函数): comment_form_title()
  • Function(函数): comment_form(),
  • Function(函数): comment_ID()
  • Function(函数): comment_id_fields()
  • Function(函数): comment_reply_link()
  • Function(函数): comment_text()
  • Function(函数): comment_text_rss()
  • Function(函数): comment_time()
  • Function(函数): comment_type()
  • Function(函数): comments_link
  • Function(函数): comments_number()
  • Function(函数): comments_open(),
  • Function(函数): comments_popup_link()
  • Function(函数): comments_popup_script()
  • Function(函数): comments_rss_link()
  • Function(函数): get_avatar()
  • Function(函数): next_comments_link()
  • Function(函数): paginate_comments_links()
  • Function(函数): permalink_comments_rss()
  • Function(函数): previous_comments_link()
  • Function(函数): wp_list_comments()
  • 原文:http://codex.wordpress.org/Function_Reference/comments_number
类别:WordPress函数文档

本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

评论 (0)COMMENT