A WordPress-centric search engine for devs and theme authors



comment_form_title ›

Since2.7.0
Deprecatedn/a
comment_form_title ( $noreplytext = false, $replytext = false, $linktoparent = true )
Parameters: (3)
  • (string) $noreplytext Optional. Text to display when not replying to a comment. Default false.
    Required: No
    Default: false
  • (string) $replytext Optional. Text to display when replying to a comment. Default false. Accepts "%s" for the author of the comment being replied to.
    Required: No
    Default: false
  • (string) $linktoparent Optional. Boolean to control making the author's name a link to their comment. Default true.
    Required: No
    Default: true
Defined at:
Codex:

Display text based on comment reply status.

Only affects users with JavaScript disabled.



Source

function comment_form_title( $noreplytext = false, $replytext = false, $linktoparent = true ) {
	global $comment;

	if ( false === $noreplytext ) {
		$noreplytext = __( 'Leave a Reply' );
	}
	if ( false === $replytext ) {
		$replytext = __( 'Leave a Reply to %s' );
	}

	$replytoid = isset( $_GET['replytocom'] ) ? (int) $_GET['replytocom'] : 0;

	if ( 0 == $replytoid ) {
		echo $noreplytext;
	} else {
		// Sets the global so that template tags can be used in the comment form.
		$comment = get_comment( $replytoid );
		$author  = ( $linktoparent ) ? '<a href="#comment-' . get_comment_ID() . '">' . get_comment_author( $comment ) . '</a>' : get_comment_author( $comment );
		printf( $replytext, $author );
	}
}