comment_form_title( string $noreplytext = false, string $replytext = false, string $linktoparent = true )
Display text based on comment reply status.
Description Description
Only affects users with JavaScript disabled.
Parameters Parameters
- $noreplytext
-
(string) (Optional) Text to display when not replying to a comment.
Default value: false
- $replytext
-
(string) (Optional) Text to display when replying to a comment. Accepts "%s" for the author of the comment being replied to.
Default value: false
- $linktoparent
-
(string) (Optional) Boolean to control making the author's name a link to their comment.
Default value: true
Source Source
File: wp-includes/comment-template.php
function comment_form_title( $noreplytext = false, $replytext = false, $linktoparent = true ) {
global $comment;
if ( false === $noreplytext ) {
$noreplytext = __( 'Leave a Reply' );
}
if ( false === $replytext ) {
/* translators: %s: Author of the comment being replied to. */
$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 );
}
}
Expand full source code Collapse full source code View on Trac
Changelog Changelog
| Version | Description |
|---|---|
| 2.7.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Basic Example