comment_type

Display the comment type of the current comment.

Description

comment_type( (constant) $commenttxt = false, (constant) $trackbacktxt = false, (bool) $pingbacktxt = false ); 

Parameters (3)

0. $commenttxt — Optional. (constant) => false
String to display for comment type. Default false.
1. $trackbacktxt — Optional. (constant) => false
String to display for trackback type. Default false.
2. $pingbacktxt — Optional. (bool) => false
String to display for pingback type. Default false.

Usage

  1. if ( !function_exists( 'comment_type' ) ) { 
  2. require_once ABSPATH . WPINC . '/comment-template.php'; 
  3.  
  4. // Optional. String to display for comment type. Default false. 
  5. $commenttxt = false; 
  6.  
  7. // Optional. String to display for trackback type. Default false. 
  8. $trackbacktxt = false; 
  9.  
  10. // Optional. String to display for pingback type. Default false. 
  11. $pingbacktxt = false; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = comment_type($commenttxt, $trackbacktxt, $pingbacktxt); 
  15.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/comment-template.php  
  1. function comment_type( $commenttxt = false, $trackbacktxt = false, $pingbacktxt = false ) { 
  2. if ( false === $commenttxt ) $commenttxt = _x( 'Comment', 'noun' ); 
  3. if ( false === $trackbacktxt ) $trackbacktxt = __( 'Trackback' ); 
  4. if ( false === $pingbacktxt ) $pingbacktxt = __( 'Pingback' ); 
  5. $type = get_comment_type(); 
  6. switch( $type ) { 
  7. case 'trackback' : 
  8. echo $trackbacktxt; 
  9. break; 
  10. case 'pingback' : 
  11. echo $pingbacktxt; 
  12. break; 
  13. default : 
  14. echo $commenttxt;