comment_type( string|false $commenttxt = false, string|false $trackbacktxt = false, string|false $pingbacktxt = false )

Displays the comment type of the current comment.

Parameters

$commenttxtstring|falseoptional
String to display for comment type.

Default:false

$trackbacktxtstring|falseoptional
String to display for trackback type.

Default:false

$pingbacktxtstring|falseoptional
String to display for pingback type.

Default:false

Source

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

Changelog

VersionDescription
0.71Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.