Displays the comment type of the current comment.
Parameters
$comment_textstring|falseoptional- String to display for comment type.
Default:
false $trackback_textstring|falseoptional- String to display for trackback type.
Default:
false $pingback_textstring|falseoptional- String to display for pingback type.
Default:
false
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;
}
}
Changelog
| Version | Description |
|---|---|
| 0.71 | Introduced. |
Basic Example