comments_popup_link
函数
comments_popup_link ( $zero = false, $one = false, $more = false, $css_class = '', $none = false )
- 参数
-
-
(false|string)
$zero
Optional. String to display when no comments. Default false.- Required: 否
- Default: false
-
(false|string)
$one
Optional. String to display when only one comment is available. Default false.- Required: 否
- Default: false
-
(false|string)
$more
Optional. String to display when there are more than one comment. Default false.- Required: 否
- Default: false
-
(string)
$css_class
Optional. CSS class to use for comments. Default empty.- Required: 否
- Default: (empty)
-
(false|string)
$none
Optional. String to display when comments have been turned off. Default false.- Required: 否
- Default: false
-
(false|string)
- 定义位置
-
-
wp-includes/comment-template.php
, line 1569
-
wp-includes/comment-template.php
- 引入
- 0.71
- 弃用
- –
Displays the link to the comments for the current post ID.
function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) { $post_id = get_the_ID(); $post_title = get_the_title(); $number = get_comments_number( $post_id ); if ( false === $zero ) { /* translators: %s: Post title. */ $zero = sprintf( __( 'No Comments on %s' ), $post_title ); } if ( false === $one ) { /* translators: %s: Post title. */ $one = sprintf( __( '1 Comment on %s' ), $post_title ); } if ( false === $more ) { /* translators: 1: Number of comments, 2: Post title. */ $more = _n( '%1$s Comment on %2$s', '%1$s Comments on %2$s', $number ); $more = sprintf( $more, number_format_i18n( $number ), $post_title ); } if ( false === $none ) { /* translators: %s: Post title. */ $none = sprintf( __( 'Comments Off on %s' ), $post_title ); } if ( 0 == $number && ! comments_open() && ! pings_open() ) { echo '' . $none . ''; return; } if ( post_password_required() ) { _e( 'Enter your password to view comments.' ); return; } echo ''; comments_number( $zero, $one, $more ); echo ''; }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。