From 405af2137f29d03cd2d4c1160bb97d44961139a5 Mon Sep 17 00:00:00 2001 From: narenin Date: Fri, 30 Aug 2024 10:52:58 +0530 Subject: [PATCH 1/4] Fixed : Convert div to main tag for web accessibility --- src/wp-includes/block-template.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/block-template.php b/src/wp-includes/block-template.php index 0a4d85ac718a9..f0b07ac088e8c 100644 --- a/src/wp-includes/block-template.php +++ b/src/wp-includes/block-template.php @@ -268,9 +268,15 @@ function get_the_block_template_html() { $content = wp_filter_content_tags( $content, 'template' ); $content = str_replace( ']]>', ']]>', $content ); + /* + * Ticket : 61956 + * Filter to allow modification of the wrapper element. + */ + $wrapper_element = apply_filters( 'wp_site_blocks_wrapper_element', 'div', $content ); + // Wrap block template in .wp-site-blocks to allow for specific descendant styles // (e.g. `.wp-site-blocks > *`). - return '
' . $content . '
'; + return "<{$wrapper_element} class=\"wp-site-blocks\">{$content}"; } /** From e13ae3ae910ea3c762c3f033bbfc39688bc8bf4d Mon Sep 17 00:00:00 2001 From: narenin Date: Sun, 1 Sep 2024 19:15:10 +0530 Subject: [PATCH 2/4] Added the formatting as per the doc --- src/wp-includes/block-template.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/block-template.php b/src/wp-includes/block-template.php index f0b07ac088e8c..ccc9a688c0040 100644 --- a/src/wp-includes/block-template.php +++ b/src/wp-includes/block-template.php @@ -268,9 +268,16 @@ function get_the_block_template_html() { $content = wp_filter_content_tags( $content, 'template' ); $content = str_replace( ']]>', ']]>', $content ); - /* - * Ticket : 61956 - * Filter to allow modification of the wrapper element. + /** + * Filters the wrapper element used in the site blocks. + * + * This filter allows the modification of the wrapper element that encloses the site blocks. + * + * @since 6.6.2 + * + * @param string $element The HTML element to be used as the wrapper. Default 'div'. + * @param string $content The content to be wrapped. + * @return string The filtered wrapper element. */ $wrapper_element = apply_filters( 'wp_site_blocks_wrapper_element', 'div', $content ); From 8c2be70134458b83d98a85d73ed995f5b2c947e5 Mon Sep 17 00:00:00 2001 From: Narendra Sishodiya <32844880+narenin@users.noreply.github.com> Date: Mon, 2 Sep 2024 10:02:11 +0530 Subject: [PATCH 3/4] Update src/wp-includes/block-template.php Co-authored-by: Mukesh Panchal --- src/wp-includes/block-template.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/wp-includes/block-template.php b/src/wp-includes/block-template.php index ccc9a688c0040..0a35c7e491f39 100644 --- a/src/wp-includes/block-template.php +++ b/src/wp-includes/block-template.php @@ -277,7 +277,6 @@ function get_the_block_template_html() { * * @param string $element The HTML element to be used as the wrapper. Default 'div'. * @param string $content The content to be wrapped. - * @return string The filtered wrapper element. */ $wrapper_element = apply_filters( 'wp_site_blocks_wrapper_element', 'div', $content ); From d5219e4af3cc170d94b375a05c3330d79d5f805b Mon Sep 17 00:00:00 2001 From: Narendra Sishodiya <32844880+narenin@users.noreply.github.com> Date: Mon, 2 Sep 2024 10:02:23 +0530 Subject: [PATCH 4/4] Update src/wp-includes/block-template.php Co-authored-by: Mukesh Panchal --- src/wp-includes/block-template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/block-template.php b/src/wp-includes/block-template.php index 0a35c7e491f39..2c4d758e2b865 100644 --- a/src/wp-includes/block-template.php +++ b/src/wp-includes/block-template.php @@ -273,7 +273,7 @@ function get_the_block_template_html() { * * This filter allows the modification of the wrapper element that encloses the site blocks. * - * @since 6.6.2 + * @since 6.7.0 * * @param string $element The HTML element to be used as the wrapper. Default 'div'. * @param string $content The content to be wrapped.