wpseek.com
A WordPress-centric search engine for devs and theme authors



comment_type › WordPress Function

Since0.71
Deprecatedn/a
comment_type ( $comment_text = false, $trackback_text = false, $pingback_text = false )
Parameters: (3)
  • (string|false) $comment_text Optional. String to display for comment type. Default false.
    Required: No
    Default: false
  • (string|false) $trackback_text Optional. String to display for trackback type. Default false.
    Required: No
    Default: false
  • (string|false) $pingback_text Optional. String to display for pingback type. Default false.
    Required: No
    Default: false
Defined at:
Codex:

Displays the comment type of the current comment.



Source

function comment_type( $comment_text = false, $trackback_text = false, $pingback_text = false ) {
	if ( false === $comment_text ) {
		$comment_text = _x( 'Comment', 'noun' );
	}
	if ( false === $trackback_text ) {
		$trackback_text = __( 'Trackback' );
	}
	if ( false === $pingback_text ) {
		$pingback_text = __( 'Pingback' );
	}
	$type = get_comment_type();
	switch ( $type ) {
		case 'trackback':
			echo $trackback_text;
			break;
		case 'pingback':
			echo $pingback_text;
			break;
		default:
			echo $comment_text;
	}
}