From 77cf4ea88da769d8f64461c6a486a707291c3d65 Mon Sep 17 00:00:00 2001 From: davidbaumwald Date: Wed, 19 May 2021 18:39:56 +0000 Subject: [PATCH] Twenty Twenty: Correct `label` attribute references to `aria_label` in `get_search_form`. In the bundled Twenty Twenty theme, a `label` argument was passed to `get_search_form` but used as the `aria_label` on the form. This change updates the argument name to `aria_label` and maintains backwards compatibility for usage of the original `label` argument. Props poena, sabernhardt, ipulc2, kishanjasani, mukesh27. Fixes #51877. Built from https://develop.svn.wordpress.org/trunk@50933 git-svn-id: http://core.svn.wordpress.org/trunk@50542 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-content/themes/twentytwenty/404.php | 2 +- wp-content/themes/twentytwenty/index.php | 2 +- wp-content/themes/twentytwenty/searchform.php | 6 +++++- .../themes/twentytwenty/template-parts/modal-search.php | 2 +- wp-includes/version.php | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/wp-content/themes/twentytwenty/404.php b/wp-content/themes/twentytwenty/404.php index 64c25039a9..7e7e0cdc6f 100644 --- a/wp-content/themes/twentytwenty/404.php +++ b/wp-content/themes/twentytwenty/404.php @@ -21,7 +21,7 @@ get_header(); __( '404 not found', 'twentytwenty' ), + 'aria_label' => __( '404 not found', 'twentytwenty' ), ) ); ?> diff --git a/wp-content/themes/twentytwenty/index.php b/wp-content/themes/twentytwenty/index.php index b3037b660d..fb0a5d809a 100644 --- a/wp-content/themes/twentytwenty/index.php +++ b/wp-content/themes/twentytwenty/index.php @@ -98,7 +98,7 @@ get_header(); __( 'search again', 'twentytwenty' ), + 'aria_label' => __( 'search again', 'twentytwenty' ), ) ); ?> diff --git a/wp-content/themes/twentytwenty/searchform.php b/wp-content/themes/twentytwenty/searchform.php index 2acf8308b8..428a513b5c 100644 --- a/wp-content/themes/twentytwenty/searchform.php +++ b/wp-content/themes/twentytwenty/searchform.php @@ -17,7 +17,11 @@ */ $twentytwenty_unique_id = twentytwenty_unique_id( 'search-form-' ); -$twentytwenty_aria_label = ! empty( $args['label'] ) ? 'aria-label="' . esc_attr( $args['label'] ) . '"' : ''; +$twentytwenty_aria_label = ! empty( $args['aria_label'] ) ? 'aria-label="' . esc_attr( $args['aria_label'] ) . '"' : ''; +// Backward compatibility, in case a child theme template uses a `label` argument. +if ( empty( $twentytwenty_aria_label ) && ! empty( $args['label'] ) ) { + $twentytwenty_aria_label = 'aria-label="' . esc_attr( $args['label'] ) . '"'; +} ?>
method="get" class="search-form" action="">