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

Display the comment type of the current comment.


Description Description


Parameters Parameters

$commenttxt

(string) (Optional) String to display for comment type.

Default value: false

$trackbacktxt

(string) (Optional) String to display for trackback type.

Default value: false

$pingbacktxt

(string) (Optional) String to display for pingback type.

Default value: false


Top ↑

Source Source

File: wp-includes/comment-template.php

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

Top ↑

Changelog Changelog

Changelog
Version Description
0.71 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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