From 5c07bc0b59dcffd3b78047f2a265381a9d84cda1 Mon Sep 17 00:00:00 2001 From: audrasjb Date: Sun, 10 Apr 2022 22:29:03 +0000 Subject: [PATCH] Twenty Twenty One: Prevent loading translation file twice. This changes wraps the registration of patterns and pattern categories in a function hooked to `init`, to avoid loading the Twenty Twenty One translation file twice. Props zodiac1978, sabernhardt, audrasjb. Fixes #53589. Built from https://develop.svn.wordpress.org/trunk@53121 git-svn-id: http://core.svn.wordpress.org/trunk@52710 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../twentytwentyone/inc/block-patterns.php | 201 ++++++++++-------- wp-includes/version.php | 2 +- 2 files changed, 110 insertions(+), 93 deletions(-) diff --git a/wp-content/themes/twentytwentyone/inc/block-patterns.php b/wp-content/themes/twentytwentyone/inc/block-patterns.php index bc89e86661..cd66ff9c66 100644 --- a/wp-content/themes/twentytwentyone/inc/block-patterns.php +++ b/wp-content/themes/twentytwentyone/inc/block-patterns.php @@ -10,111 +10,128 @@ * @since Twenty Twenty-One 1.0 */ -/** - * Register Block Pattern Category. - */ if ( function_exists( 'register_block_pattern_category' ) ) { - - register_block_pattern_category( - 'twentytwentyone', - array( 'label' => esc_html__( 'Twenty Twenty-One', 'twentytwentyone' ) ) - ); + /** + * Register Block Pattern Category. + * + * @since Twenty Twenty-One 1.0 + * + * @return void + */ + function twenty_twenty_one_register_block_pattern_category() { + register_block_pattern_category( + 'twentytwentyone', + array( 'label' => esc_html__( 'Twenty Twenty-One', 'twentytwentyone' ) ) + ); + } + add_action( 'init', 'twenty_twenty_one_register_block_pattern_category' ); } /** * Register Block Patterns. */ if ( function_exists( 'register_block_pattern' ) ) { + /** + * Register Block Pattern. + * + * @since Twenty Twenty-One 1.0 + * + * @return void + */ + function twenty_twenty_one_register_block_pattern() { - // Large Text. - register_block_pattern( - 'twentytwentyone/large-text', - array( - 'title' => esc_html__( 'Large text', 'twentytwentyone' ), - 'categories' => array( 'twentytwentyone' ), - 'viewportWidth' => 1440, - 'content' => '

' . esc_html__( 'A new portfolio default theme for WordPress', 'twentytwentyone' ) . '

', - ) - ); + // Large Text. + register_block_pattern( + 'twentytwentyone/large-text', + array( + 'title' => esc_html__( 'Large text', 'twentytwentyone' ), + 'categories' => array( 'twentytwentyone' ), + 'viewportWidth' => 1440, + 'content' => '

' . esc_html__( 'A new portfolio default theme for WordPress', 'twentytwentyone' ) . '

', + ) + ); - // Links Area. - register_block_pattern( - 'twentytwentyone/links-area', - array( - 'title' => esc_html__( 'Links area', 'twentytwentyone' ), - 'categories' => array( 'twentytwentyone' ), - 'viewportWidth' => 1440, - 'description' => esc_html_x( 'A huge text followed by social networks and email address links.', 'Block pattern description', 'twentytwentyone' ), - 'content' => '

', - ) - ); + // Links Area. + register_block_pattern( + 'twentytwentyone/links-area', + array( + 'title' => esc_html__( 'Links area', 'twentytwentyone' ), + 'categories' => array( 'twentytwentyone' ), + 'viewportWidth' => 1440, + 'description' => esc_html_x( 'A huge text followed by social networks and email address links.', 'Block pattern description', 'twentytwentyone' ), + 'content' => '

', + ) + ); - // Media & Text Article Title. - register_block_pattern( - 'twentytwentyone/media-text-article-title', - array( - 'title' => esc_html__( 'Media and text article title', 'twentytwentyone' ), - 'categories' => array( 'twentytwentyone' ), - 'viewportWidth' => 1440, - 'description' => esc_html_x( 'A Media & Text block with a big image on the left and a heading on the right. The heading is followed by a separator and a description paragraph.', 'Block pattern description', 'twentytwentyone' ), - 'content' => '
' . esc_attr__( '“Playing in the Sand” by Berthe Morisot', 'twentytwentyone' ) . '

' . esc_html__( 'Playing in the Sand', 'twentytwentyone' ) . '


' . wp_kses_post( __( 'Berthe Morisot
(French, 1841-1895)', 'twentytwentyone' ) ) . '

', - ) - ); + // Media & Text Article Title. + register_block_pattern( + 'twentytwentyone/media-text-article-title', + array( + 'title' => esc_html__( 'Media and text article title', 'twentytwentyone' ), + 'categories' => array( 'twentytwentyone' ), + 'viewportWidth' => 1440, + 'description' => esc_html_x( 'A Media & Text block with a big image on the left and a heading on the right. The heading is followed by a separator and a description paragraph.', 'Block pattern description', 'twentytwentyone' ), + 'content' => '
' . esc_attr__( '“Playing in the Sand” by Berthe Morisot', 'twentytwentyone' ) . '

' . esc_html__( 'Playing in the Sand', 'twentytwentyone' ) . '


' . wp_kses_post( __( 'Berthe Morisot
(French, 1841-1895)', 'twentytwentyone' ) ) . '

', + ) + ); - // Overlapping Images. - register_block_pattern( - 'twentytwentyone/overlapping-images', - array( - 'title' => esc_html__( 'Overlapping images', 'twentytwentyone' ), - 'categories' => array( 'twentytwentyone' ), - 'viewportWidth' => 1024, - 'description' => esc_html_x( 'Three images inside an overlapping columns block.', 'Block pattern description', 'twentytwentyone' ), - 'content' => '
' . esc_attr__( '“Roses Trémières” by Berthe Morisot', 'twentytwentyone' ) . '
' . esc_attr__( '“In the Bois de Boulogne” by Berthe Morisot', 'twentytwentyone' ) . '
' . esc_attr__( '“Young Woman in Mauve” by Berthe Morisot', 'twentytwentyone' ) . '
', - ) - ); + // Overlapping Images. + register_block_pattern( + 'twentytwentyone/overlapping-images', + array( + 'title' => esc_html__( 'Overlapping images', 'twentytwentyone' ), + 'categories' => array( 'twentytwentyone' ), + 'viewportWidth' => 1024, + 'description' => esc_html_x( 'Three images inside an overlapping columns block.', 'Block pattern description', 'twentytwentyone' ), + 'content' => '
' . esc_attr__( '“Roses Trémières” by Berthe Morisot', 'twentytwentyone' ) . '
' . esc_attr__( '“In the Bois de Boulogne” by Berthe Morisot', 'twentytwentyone' ) . '
' . esc_attr__( '“Young Woman in Mauve” by Berthe Morisot', 'twentytwentyone' ) . '
', + ) + ); - // Two Images Showcase. - register_block_pattern( - 'twentytwentyone/two-images-showcase', - array( - 'title' => esc_html__( 'Two images showcase', 'twentytwentyone' ), - 'categories' => array( 'twentytwentyone' ), - 'viewportWidth' => 1440, - 'description' => esc_html_x( 'A media & text block with a big image on the left and a smaller one with bordered frame on the right.', 'Block pattern description', 'twentytwentyone' ), - 'content' => '
' . esc_attr__( '“Daffodils” by Berthe Morisot', 'twentytwentyone' ) . '
' . esc_attr__( '“Self portrait” by Berthe Morisot', 'twentytwentyone' ) . '
', - ) - ); + // Two Images Showcase. + register_block_pattern( + 'twentytwentyone/two-images-showcase', + array( + 'title' => esc_html__( 'Two images showcase', 'twentytwentyone' ), + 'categories' => array( 'twentytwentyone' ), + 'viewportWidth' => 1440, + 'description' => esc_html_x( 'A media & text block with a big image on the left and a smaller one with bordered frame on the right.', 'Block pattern description', 'twentytwentyone' ), + 'content' => '
' . esc_attr__( '“Daffodils” by Berthe Morisot', 'twentytwentyone' ) . '
' . esc_attr__( '“Self portrait” by Berthe Morisot', 'twentytwentyone' ) . '
', + ) + ); - // Overlapping Images and Text. - register_block_pattern( - 'twentytwentyone/overlapping-images-and-text', - array( - 'title' => esc_html__( 'Overlapping images and text', 'twentytwentyone' ), - 'categories' => array( 'twentytwentyone' ), - 'viewportWidth' => 1440, - 'description' => esc_html_x( 'An overlapping columns block with two images and a text description.', 'Block pattern description', 'twentytwentyone' ), - 'content' => '
' . esc_attr__( '“The Garden at Bougival” by Berthe Morisot', 'twentytwentyone' ) . '

' . esc_html__( 'Beautiful gardens painted by Berthe Morisot in the late 1800s', 'twentytwentyone' ) . '

' . esc_attr__( '“Villa with Orange Trees, Nice” by Berthe Morisot', 'twentytwentyone' ) . '
', - ) - ); + // Overlapping Images and Text. + register_block_pattern( + 'twentytwentyone/overlapping-images-and-text', + array( + 'title' => esc_html__( 'Overlapping images and text', 'twentytwentyone' ), + 'categories' => array( 'twentytwentyone' ), + 'viewportWidth' => 1440, + 'description' => esc_html_x( 'An overlapping columns block with two images and a text description.', 'Block pattern description', 'twentytwentyone' ), + 'content' => '
' . esc_attr__( '“The Garden at Bougival” by Berthe Morisot', 'twentytwentyone' ) . '

' . esc_html__( 'Beautiful gardens painted by Berthe Morisot in the late 1800s', 'twentytwentyone' ) . '

' . esc_attr__( '“Villa with Orange Trees, Nice” by Berthe Morisot', 'twentytwentyone' ) . '
', + ) + ); - // Portfolio List. - register_block_pattern( - 'twentytwentyone/portfolio-list', - array( - 'title' => esc_html__( 'Portfolio list', 'twentytwentyone' ), - 'categories' => array( 'twentytwentyone' ), - 'description' => esc_html_x( 'A list of projects with thumbnail images.', 'Block pattern description', 'twentytwentyone' ), - 'content' => '
' . esc_attr__( '“Roses Trémières” by Berthe Morisot', 'twentytwentyone' ) . '

“Villa with Orange Trees, Nice” by Berthe Morisot

' . esc_attr__( '“In the Bois de Boulogne” by Berthe Morisot', 'twentytwentyone' ) . '

' . esc_attr__( '“The Garden at Bougival” by Berthe Morisot', 'twentytwentyone' ) . '

' . esc_attr__( '“Young Woman in Mauve” by Berthe Morisot', 'twentytwentyone' ) . '

' . esc_attr__( '“Reading” by Berthe Morisot', 'twentytwentyone' ) . '

', - ) - ); + // Portfolio List. + register_block_pattern( + 'twentytwentyone/portfolio-list', + array( + 'title' => esc_html__( 'Portfolio list', 'twentytwentyone' ), + 'categories' => array( 'twentytwentyone' ), + 'description' => esc_html_x( 'A list of projects with thumbnail images.', 'Block pattern description', 'twentytwentyone' ), + 'content' => '
' . esc_attr__( '“Roses Trémières” by Berthe Morisot', 'twentytwentyone' ) . '

“Villa with Orange Trees, Nice” by Berthe Morisot

' . esc_attr__( '“In the Bois de Boulogne” by Berthe Morisot', 'twentytwentyone' ) . '

' . esc_attr__( '“The Garden at Bougival” by Berthe Morisot', 'twentytwentyone' ) . '

' . esc_attr__( '“Young Woman in Mauve” by Berthe Morisot', 'twentytwentyone' ) . '

' . esc_attr__( '“Reading” by Berthe Morisot', 'twentytwentyone' ) . '

', + ) + ); - register_block_pattern( - 'twentytwentyone/contact-information', - array( - 'title' => esc_html__( 'Contact information', 'twentytwentyone' ), - 'categories' => array( 'twentytwentyone' ), - 'description' => esc_html_x( 'A block with 3 columns that display contact information and social media links.', 'Block pattern description', 'twentytwentyone' ), - 'content' => '

' . esc_html_x( 'example@example.com', 'Block pattern sample content', 'twentytwentyone' ) . '
' . esc_html_x( '123-456-7890', 'Block pattern sample content', 'twentytwentyone' ) . '

' . esc_html_x( '123 Main Street', 'Block pattern sample content', 'twentytwentyone' ) . '
' . esc_html_x( 'Cambridge, MA, 02139', 'Block pattern sample content', 'twentytwentyone' ) . '

', - ) - ); + register_block_pattern( + 'twentytwentyone/contact-information', + array( + 'title' => esc_html__( 'Contact information', 'twentytwentyone' ), + 'categories' => array( 'twentytwentyone' ), + 'description' => esc_html_x( 'A block with 3 columns that display contact information and social media links.', 'Block pattern description', 'twentytwentyone' ), + 'content' => '

' . esc_html_x( 'example@example.com', 'Block pattern sample content', 'twentytwentyone' ) . '
' . esc_html_x( '123-456-7890', 'Block pattern sample content', 'twentytwentyone' ) . '

' . esc_html_x( '123 Main Street', 'Block pattern sample content', 'twentytwentyone' ) . '
' . esc_html_x( 'Cambridge, MA, 02139', 'Block pattern sample content', 'twentytwentyone' ) . '

', + ) + ); + + } + add_action( 'init', 'twenty_twenty_one_register_block_pattern' ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 3180e1d21a..66492af26f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-alpha-53120'; +$wp_version = '6.0-alpha-53121'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.