From 07cf5c5c763ff0248fb3e162b4f31396b060c7ff Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 2 Oct 2014 20:40:35 +0000 Subject: [PATCH] Add an aria-label attribute with commenter's name to get_comment_reply_link(). props joedolson, merty, andrewryno. fixes #16433. git-svn-id: https://develop.svn.wordpress.org/trunk@29822 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/comment-template.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/wp-includes/comment-template.php b/src/wp-includes/comment-template.php index 76a0ee0ff9..026498821e 100644 --- a/src/wp-includes/comment-template.php +++ b/src/wp-includes/comment-template.php @@ -1305,13 +1305,14 @@ function comments_popup_link( $zero = false, $one = false, $more = false, $css_c function get_comment_reply_link( $args = array(), $comment = null, $post = null ) { $defaults = array( - 'add_below' => 'comment', - 'respond_id' => 'respond', - 'reply_text' => __('Reply'), - 'login_text' => __('Log in to Reply'), - 'depth' => 0, - 'before' => '', - 'after' => '' + 'add_below' => 'comment', + 'respond_id' => 'respond', + 'reply_text' => __( 'Reply' ), + 'reply_to_text' => __( 'Reply to %s' ), + 'login_text' => __( 'Log in to Reply' ), + 'depth' => 0, + 'before' => '', + 'after' => '' ); $args = wp_parse_args( $args, $defaults ); @@ -1337,7 +1338,7 @@ function get_comment_reply_link( $args = array(), $comment = null, $post = null if ( get_option( 'comment_registration' ) && ! is_user_logged_in() ) { $link = '' . $args['login_text'] . ''; } else { - $link = "comment_ID ) ) . "#" . $respond_id . "' onclick='return addComment.moveForm(\"$add_below-$comment->comment_ID\", \"$comment->comment_ID\", \"$respond_id\", \"$post->ID\")'>$reply_text"; + $link = "comment_ID ) ) . "#" . $respond_id . "' onclick='return addComment.moveForm(\"$add_below-$comment->comment_ID\", \"$comment->comment_ID\", \"$respond_id\", \"$post->ID\")' aria-label='" . esc_attr( sprintf( $args['reply_to_text'], $comment->comment_author ) ) . "'>$reply_text"; } /** * Filter the comment reply link.