Displays text based on comment reply status.
Description
Only affects users with JavaScript disabled.
Parameters
$no_reply_text
string|false
Optional
Text to display when not replying to a comment.
Default: false
$reply_text
string|false
Optional
Text to display when replying to a comment.
Accepts "%s" for the author of the comment being replied to.
Default: false
$link_to_parent
bool
Optional
Boolean to control making the author"s name a link to their comment.
Default: true
$post
int|WP_Post|null
Optional
The post that the comment form is being displayed for.
Defaults to the current global post.
Default: null
Source
File: wp-includes/comment-template.php.
View all references
function comment_form_title( $no_reply_text = false, $reply_text = false, $link_to_parent = true, $post = null ) {
global $comment;
if ( false === $no_reply_text ) {
$no_reply_text = __( "Leave a Reply" );
}
if ( false === $reply_text ) {
/* translators: %s: Author of the comment being replied to. */
$reply_text = __( "Leave a Reply to %s" );
}
$post = get_post( $post );
if ( ! $post ) {
echo $no_reply_text;
return;
}
$reply_to_id = _get_comment_reply_id( $post->ID );
if ( 0 === $reply_to_id ) {
echo $no_reply_text;
return;
}
// Sets the global so that template tags can be used in the comment form.
$comment = get_comment( $reply_to_id );
if ( $link_to_parent ) {
$author = "<a href="#comment-" . get_comment_ID() . "">" . get_comment_author( $reply_to_id ) . "</a>";
} else {
$author = get_comment_author( $reply_to_id );
}
printf( $reply_text, $author );
}
More Information
This function affects users with Javascript disabled or pages without the comment-reply.js JavaScript loaded.
This function is normally used directly below <div id="respond"> and before the comment form.