From e8f521066e732f62e240a55690f844003a1beb0a Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Wed, 14 Sep 2022 13:56:14 +0200 Subject: [PATCH 1/5] [Backport] Add wp_theme_element_class_name() alias --- src/wp-includes/theme.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index 3c7b297b2a802..90c1630dd0ffb 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -4203,6 +4203,20 @@ function wp_is_block_theme() { return wp_get_theme()->is_block_theme(); } +/** + * Given an element name, returns a class name. + * Alias from WP_Theme_JSON::get_element_class_name. + * + * @param string $element The name of the element. + * + * @return string The name of the class. + * + * @since 6.1.0 + */ +function wp_theme_element_class_name( $element ) { + return WP_Theme_JSON::get_element_class_name( $element ); +} + /** * Adds default theme supports for block themes when the 'setup_theme' action fires. * From 68ffc05864d84e58f3767cba6251aba86eb49c05 Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Wed, 14 Sep 2022 16:07:14 +0200 Subject: [PATCH 2/5] from -> of Co-authored-by: Colin Stewart <79332690+costdev@users.noreply.github.com> --- src/wp-includes/theme.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index 90c1630dd0ffb..cc02c4871b600 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -4205,7 +4205,7 @@ function wp_is_block_theme() { /** * Given an element name, returns a class name. - * Alias from WP_Theme_JSON::get_element_class_name. + * Alias of WP_Theme_JSON::get_element_class_name. * * @param string $element The name of the element. * From 33f1626824c49197b48a2d3d1f651afa07da890b Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Wed, 14 Sep 2022 16:11:57 +0200 Subject: [PATCH 3/5] Move since PHPDoc up a bit --- src/wp-includes/theme.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index cc02c4871b600..75088def785a3 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -4207,11 +4207,12 @@ function wp_is_block_theme() { * Given an element name, returns a class name. * Alias of WP_Theme_JSON::get_element_class_name. * + * @since 6.1.0 + * * @param string $element The name of the element. * * @return string The name of the class. * - * @since 6.1.0 */ function wp_theme_element_class_name( $element ) { return WP_Theme_JSON::get_element_class_name( $element ); From 516777bc38dc379e9543408145ed8438960a33c4 Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Wed, 14 Sep 2022 16:19:53 +0200 Subject: [PATCH 4/5] Remove empty line Co-authored-by: Colin Stewart <79332690+costdev@users.noreply.github.com> --- src/wp-includes/theme.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index 75088def785a3..a4dfffcb194cb 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -4212,7 +4212,6 @@ function wp_is_block_theme() { * @param string $element The name of the element. * * @return string The name of the class. - * */ function wp_theme_element_class_name( $element ) { return WP_Theme_JSON::get_element_class_name( $element ); From 4c850249913e5f14fb6d4599ee759b83ae684dab Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Wed, 14 Sep 2022 16:40:52 +0200 Subject: [PATCH 5/5] Change function name to wp_theme_get_element_class_name --- src/wp-includes/theme.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index a4dfffcb194cb..7ab1a7242e330 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -4213,7 +4213,7 @@ function wp_is_block_theme() { * * @return string The name of the class. */ -function wp_theme_element_class_name( $element ) { +function wp_theme_get_element_class_name( $element ) { return WP_Theme_JSON::get_element_class_name( $element ); }