comment_type
函数
comment_type ( $commenttxt = false, $trackbacktxt = false, $pingbacktxt = false )
- 参数
-
-
(string|false)
$commenttxt
Optional. String to display for comment type. Default false.- Required: 否
- Default: false
-
(string|false)
$trackbacktxt
Optional. String to display for trackback type. Default false.- Required: 否
- Default: false
-
(string|false)
$pingbacktxt
Optional. String to display for pingback type. Default false.- Required: 否
- Default: false
-
(string|false)
- 定义位置
-
-
wp-includes/comment-template.php
, line 1113
-
wp-includes/comment-template.php
- 引入
- 0.71
- 弃用
- –
Displays the comment type of the current comment.
function comment_type( $commenttxt = false, $trackbacktxt = false, $pingbacktxt = false ) {
if ( false === $commenttxt ) {
$commenttxt = _x( 'Comment', 'noun' );
}
if ( false === $trackbacktxt ) {
$trackbacktxt = __( 'Trackback' );
}
if ( false === $pingbacktxt ) {
$pingbacktxt = __( 'Pingback' );
}
$type = get_comment_type();
switch ( $type ) {
case 'trackback':
echo $trackbacktxt;
break;
case 'pingback':
echo $pingbacktxt;
break;
default:
echo $commenttxt;
}
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。