Add `title_reply_before` and `title_reply_after` args to `comment_form()` to allow the "Leave a Reply" heading level to be changed.

Props tyxla.
Fixes #33775.

Built from https://develop.svn.wordpress.org/trunk@34308


git-svn-id: http://core.svn.wordpress.org/trunk@34272 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-09-18 19:18:26 +00:00
parent 026bec7990
commit 1d0774e784
2 changed files with 22 additions and 2 deletions

View File

@ -1881,6 +1881,7 @@ function wp_list_comments( $args = array(), $comments = null ) {
* @since 3.0.0 * @since 3.0.0
* @since 4.1.0 Introduced the 'class_submit' argument. * @since 4.1.0 Introduced the 'class_submit' argument.
* @since 4.2.0 Introduced 'submit_button' and 'submit_fields' arguments. * @since 4.2.0 Introduced 'submit_button' and 'submit_fields' arguments.
* @since 4.4.0 Introduced 'title_reply_before' and 'title_reply_after' arguments.
* *
* @param array $args { * @param array $args {
* Optional. Default arguments and form fields to override. * Optional. Default arguments and form fields to override.
@ -1905,6 +1906,10 @@ function wp_list_comments( $args = array(), $comments = null ) {
* @type string $title_reply The translatable 'reply' button label. Default 'Leave a Reply'. * @type string $title_reply The translatable 'reply' button label. Default 'Leave a Reply'.
* @type string $title_reply_to The translatable 'reply-to' button label. Default 'Leave a Reply to %s', * @type string $title_reply_to The translatable 'reply-to' button label. Default 'Leave a Reply to %s',
* where %s is the author of the comment being replied to. * where %s is the author of the comment being replied to.
* @type string $title_reply_before HTML displayed before the comment form title.
* Default: '<h3 id="reply-title" class="comment-reply-title">'.
* @type string $title_reply_after HTML displayed after the comment form title.
* Default: '</h3>'.
* @type string $cancel_reply_link The translatable 'cancel reply' button label. Default 'Cancel reply'. * @type string $cancel_reply_link The translatable 'cancel reply' button label. Default 'Cancel reply'.
* @type string $label_submit The translatable 'submit' button label. Default 'Post a comment'. * @type string $label_submit The translatable 'submit' button label. Default 'Post a comment'.
* @type string $submit_button HTML format for the Submit button. * @type string $submit_button HTML format for the Submit button.
@ -1966,6 +1971,8 @@ function comment_form( $args = array(), $post_id = null ) {
'name_submit' => 'submit', 'name_submit' => 'submit',
'title_reply' => __( 'Leave a Reply' ), 'title_reply' => __( 'Leave a Reply' ),
'title_reply_to' => __( 'Leave a Reply to %s' ), 'title_reply_to' => __( 'Leave a Reply to %s' ),
'title_reply_before' => '<h3 id="reply-title" class="comment-reply-title">',
'title_reply_after' => '</h3>',
'cancel_reply_link' => __( 'Cancel reply' ), 'cancel_reply_link' => __( 'Cancel reply' ),
'label_submit' => __( 'Post Comment' ), 'label_submit' => __( 'Post Comment' ),
'submit_button' => '<input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" />', 'submit_button' => '<input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" />',
@ -1997,7 +2004,20 @@ function comment_form( $args = array(), $post_id = null ) {
do_action( 'comment_form_before' ); do_action( 'comment_form_before' );
?> ?>
<div id="respond" class="comment-respond"> <div id="respond" class="comment-respond">
<h3 id="reply-title" class="comment-reply-title"><?php comment_form_title( $args['title_reply'], $args['title_reply_to'] ); ?> <small><?php cancel_comment_reply_link( $args['cancel_reply_link'] ); ?></small></h3> <?php
echo $args['title_reply_before'];
comment_form_title( $args['title_reply'], $args['title_reply_to'] );
echo ' <small>';
cancel_comment_reply_link( $args['cancel_reply_link'] );
echo '</small>';
echo $args['title_reply_after'];
?>
<?php if ( get_option( 'comment_registration' ) && !is_user_logged_in() ) : ?> <?php if ( get_option( 'comment_registration' ) && !is_user_logged_in() ) : ?>
<?php echo $args['must_log_in']; ?> <?php echo $args['must_log_in']; ?>
<?php <?php

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-34307'; $wp_version = '4.4-alpha-34308';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.