wpseek.com
WordPress开发者和主题制作者的搜索引擎



comment_type › WordPress Function

Since0.71
已弃用n/a
comment_type ( $commenttxt = false, $trackbacktxt = false, $pingbacktxt = false )
参数: (3)
  • (string|false) $commenttxt Optional. String to display for comment type. Default false.
    Required: No
    默认: false
  • (string|false) $trackbacktxt Optional. String to display for trackback type. Default false.
    Required: No
    默认: false
  • (string|false) $pingbacktxt Optional. String to display for pingback type. Default false.
    Required: No
    默认: false
定义在:
文档:

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;
	}
}