comment_form_title

Display text based on comment reply status.

Description

comment_form_title( (constant) $noreplytext = false, (constant) $replytext = false, (bool) $linktoparent = true ); 

Only affects users with JavaScript disabled.

Parameters (3)

0. $noreplytext — Optional. (constant) => false
Text to display when not replying to a comment. Default false.
1. $replytext — Optional. (constant) => false
Text to display when replying to a comment. Default false. Accepts %s for the author of the comment being replied to.
2. $linktoparent — Optional. (bool) => true
Boolean to control making the author's name a link to their comment. Default true.

Usage

  1. if ( !function_exists( 'comment_form_title' ) ) { 
  2. require_once ABSPATH . WPINC . '/comment-template.php'; 
  3.  
  4. // Optional. Text to display when not replying to a comment. 
  5. // Default false. 
  6. $noreplytext = false; 
  7. $replytext = false; 
  8.  
  9. // Optional. Boolean to control making the author's name a link 
  10. // to their comment. Default true. 
  11. $linktoparent = true; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = comment_form_title($noreplytext, $replytext, $linktoparent); 
  15.  

Defined (1)

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

/wp-includes/comment-template.php  
  1. function comment_form_title( $noreplytext = false, $replytext = false, $linktoparent = true ) { 
  2. global $comment; 
  3.  
  4. if ( false === $noreplytext ) $noreplytext = __( 'Leave a Reply' ); 
  5. if ( false === $replytext ) $replytext = __( 'Leave a Reply to %s' ); 
  6.  
  7. $replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0; 
  8.  
  9. if ( 0 == $replytoid ) 
  10. echo $noreplytext; 
  11. else { 
  12. // Sets the global so that template tags can be used in the comment form. 
  13. $comment = get_comment($replytoid); 
  14. $author = ( $linktoparent ) ? '<a href="#comment-' . get_comment_ID() . '">' . get_comment_author( $comment ) . '</a>' : get_comment_author( $comment ); 
  15. printf( $replytext, $author );