Bundled Themes: Use correct path for loading images in block patterns.

By using `get_template_directory_uri()` instead of `get_stylesheet_directory_uri()`, we make sure to include the images from the parent theme.

This avoids displaying missing images in block patterns when using a child theme of Twenty Ten, Twenty Eleven, or Twenty Twelve.

Follow-up to [51033], [51103], [51106].

Props audrasjb, SergeyBiryukov.
Merges [51483] to the 5.8 branch.
Fixes #53769.


Built from https://develop.svn.wordpress.org/branches/5.8@51488


git-svn-id: http://core.svn.wordpress.org/branches/5.8@51099 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson 2021-07-26 03:24:57 +00:00
parent 538f14245c
commit 22bbec22de
4 changed files with 10 additions and 10 deletions

View File

@ -39,7 +39,7 @@ if ( function_exists( 'register_block_pattern' ) ) {
<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image size-large"><img src="' . get_stylesheet_directory_uri() . '/images/patterns/pattern-flower.jpg" alt="' . esc_attr( 'A yellow flower against a dark background.', 'twentyeleven' ) . '" /></figure>
<figure class="wp-block-image size-large"><img src="' . get_template_directory_uri() . '/images/patterns/pattern-flower.jpg" alt="' . esc_attr( 'A yellow flower against a dark background.', 'twentyeleven' ) . '" /></figure>
<!-- /wp:image -->
<!-- wp:paragraph {"dropCap":true} -->
<p class="has-drop-cap">' . esc_html__( 'This is just an example post to showcase the featured post section on the showcase page. Who doesn&#8217;t like flowers? I like flowers. Nullam hendrerit enim nunc. Vestibulum eget nulla magna! Fusce lobortis neque eu neque egestas tincidunt. Duis elementum consequat lorem, in eleifend justo mollis at. Nam quis adipiscing magna. Duis adipiscing est ac nibh feugiat rhoncus. Donec non lorem felis, eget commodo purus.', 'twentyeleven' ) . '</p>
@ -117,7 +117,7 @@ if ( function_exists( 'register_block_pattern' ) ) {
<!-- /wp:heading --><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image size-large"><img src="' . get_stylesheet_directory_uri() . '/images/patterns/pattern-woman.jpg" alt="' . esc_attr( 'Photo of a woman.', 'twentyeleven' ) . '" /></figure>
<figure class="wp-block-image size-large"><img src="' . get_template_directory_uri() . '/images/patterns/pattern-woman.jpg" alt="' . esc_attr( 'Photo of a woman.', 'twentyeleven' ) . '" /></figure>
<!-- /wp:image --></div>
<!-- /wp:column -->
<!-- wp:column -->

View File

@ -33,7 +33,7 @@ if ( function_exists( 'register_block_pattern' ) ) {
'title' => esc_html__( 'Introduction', 'twentyten' ),
'categories' => array( 'twentyten' ),
'viewportWidth' => 700,
'content' => '<!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} --><figure class="wp-block-image size-large"><img src="' . get_stylesheet_directory_uri() . '/images/patterns/pattern-barn.jpg" alt="' . esc_attr__( 'A red barn with a white roof in a field.', 'twentyten' ) . '" /><figcaption><em>' . esc_html__( 'An old barn we passed on the drive', 'twentyten' ) . '</em></figcaption></figure><!-- /wp:image --><!-- wp:heading {"style":{"typography":{"fontSize":60}}} --><h2 style="font-size:60px">' . esc_html__( 'A Weekend Away', 'twentyten' ) . '</h2><!-- /wp:heading --><!-- wp:paragraph --><p>' . esc_html__( 'Its amazing what a good weekend can do. After a tough couple weeks at work, I knew I needed to get away and be in nature. My partner and I decided to take a long weekend and stay in a cabin in the woods. We packed up after work on Friday and drove out into the country, passing through fields full of horses, old farms, and quaint little town squares. It was an idyllic drive. Eventually, we reached our destination and unpacked the car. We couldnt wait to cook up a simple dinner and then relax by the fireplace.', 'twentyten' ) . '</p><!-- /wp:paragraph -->',
'content' => '<!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} --><figure class="wp-block-image size-large"><img src="' . get_template_directory_uri() . '/images/patterns/pattern-barn.jpg" alt="' . esc_attr__( 'A red barn with a white roof in a field.', 'twentyten' ) . '" /><figcaption><em>' . esc_html__( 'An old barn we passed on the drive', 'twentyten' ) . '</em></figcaption></figure><!-- /wp:image --><!-- wp:heading {"style":{"typography":{"fontSize":60}}} --><h2 style="font-size:60px">' . esc_html__( 'A Weekend Away', 'twentyten' ) . '</h2><!-- /wp:heading --><!-- wp:paragraph --><p>' . esc_html__( 'Its amazing what a good weekend can do. After a tough couple weeks at work, I knew I needed to get away and be in nature. My partner and I decided to take a long weekend and stay in a cabin in the woods. We packed up after work on Friday and drove out into the country, passing through fields full of horses, old farms, and quaint little town squares. It was an idyllic drive. Eventually, we reached our destination and unpacked the car. We couldnt wait to cook up a simple dinner and then relax by the fireplace.', 'twentyten' ) . '</p><!-- /wp:paragraph -->',
)
);
@ -55,7 +55,7 @@ if ( function_exists( 'register_block_pattern' ) ) {
'title' => esc_html__( 'Alternating Images', 'twentyten' ),
'categories' => array( 'twentyten' ),
'viewportWidth' => 700,
'content' => '<!-- wp:columns {"verticalAlignment":"center"} --><div class="wp-block-columns are-vertically-aligned-center"><!-- wp:column {"verticalAlignment":"center","width":"66.66%"} --><div class="wp-block-column is-vertically-aligned-center" style="flex-basis:66.66%"><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} --><figure class="wp-block-image size-large"><img src="' . get_stylesheet_directory_uri() . '/images/patterns/pattern-dock.jpg" alt="' . esc_attr__( 'A lake with several boats docked. The sun is rising behind mountains in the background.', 'twentyten' ) . '" /><figcaption><em>' . esc_html__( 'The lake at 6:54 AM', 'twentyten' ) . '</em></figcaption></figure><!-- /wp:image --></div><!-- /wp:column --><!-- wp:column {"verticalAlignment":"top","width":"33.33%"} --><div class="wp-block-column is-vertically-aligned-top" style="flex-basis:33.33%"><!-- wp:paragraph --><p><em>' . esc_html__( 'Nearby our cabin was a lake. The sunrise looked beautiful as it rose over the hills beyond the water, reflecting down onto the gentle morning waves. I sat on the dock and drank a cup of coffee, enjoying the cool air on my skin. The coffee kept me warm inside.', 'twentyten' ) . '</em></p><!-- /wp:paragraph --></div><!-- /wp:column --></div><!-- /wp:columns --><!-- wp:columns --><div class="wp-block-columns"><!-- wp:column {"width":"33.33%"} --><div class="wp-block-column" style="flex-basis:33.33%"><!-- wp:paragraph --><p><em>' . esc_html__( 'Later that night, we went back to the lake and sat by the shore. It felt different at night; quieter, as if all of nature had gone to sleep for a little while. The only noises were the chirp of crickets and the soft splash of the waves lapping at the shore. What a beautiful way to end the day.', 'twentyten' ) . '</em></p><!-- /wp:paragraph --></div><!-- /wp:column --><!-- wp:column {"width":"66.66%"} --><div class="wp-block-column" style="flex-basis:66.66%"><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} --><figure class="wp-block-image size-large"><img src="' . get_stylesheet_directory_uri() . '/images/patterns/pattern-lake.jpg" alt="' . esc_attr__( 'A lake at night, with Adirondack chairs in the foreground. The sun sets in the background.', 'twentyten' ) . '" /><figcaption><em>' . esc_html__( 'Relaxing at the lake after dinner', 'twentyten' ) . '</em></figcaption></figure><!-- /wp:image --></div><!-- /wp:column --></div><!-- /wp:columns -->',
'content' => '<!-- wp:columns {"verticalAlignment":"center"} --><div class="wp-block-columns are-vertically-aligned-center"><!-- wp:column {"verticalAlignment":"center","width":"66.66%"} --><div class="wp-block-column is-vertically-aligned-center" style="flex-basis:66.66%"><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} --><figure class="wp-block-image size-large"><img src="' . get_template_directory_uri() . '/images/patterns/pattern-dock.jpg" alt="' . esc_attr__( 'A lake with several boats docked. The sun is rising behind mountains in the background.', 'twentyten' ) . '" /><figcaption><em>' . esc_html__( 'The lake at 6:54 AM', 'twentyten' ) . '</em></figcaption></figure><!-- /wp:image --></div><!-- /wp:column --><!-- wp:column {"verticalAlignment":"top","width":"33.33%"} --><div class="wp-block-column is-vertically-aligned-top" style="flex-basis:33.33%"><!-- wp:paragraph --><p><em>' . esc_html__( 'Nearby our cabin was a lake. The sunrise looked beautiful as it rose over the hills beyond the water, reflecting down onto the gentle morning waves. I sat on the dock and drank a cup of coffee, enjoying the cool air on my skin. The coffee kept me warm inside.', 'twentyten' ) . '</em></p><!-- /wp:paragraph --></div><!-- /wp:column --></div><!-- /wp:columns --><!-- wp:columns --><div class="wp-block-columns"><!-- wp:column {"width":"33.33%"} --><div class="wp-block-column" style="flex-basis:33.33%"><!-- wp:paragraph --><p><em>' . esc_html__( 'Later that night, we went back to the lake and sat by the shore. It felt different at night; quieter, as if all of nature had gone to sleep for a little while. The only noises were the chirp of crickets and the soft splash of the waves lapping at the shore. What a beautiful way to end the day.', 'twentyten' ) . '</em></p><!-- /wp:paragraph --></div><!-- /wp:column --><!-- wp:column {"width":"66.66%"} --><div class="wp-block-column" style="flex-basis:66.66%"><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} --><figure class="wp-block-image size-large"><img src="' . get_template_directory_uri() . '/images/patterns/pattern-lake.jpg" alt="' . esc_attr__( 'A lake at night, with Adirondack chairs in the foreground. The sun sets in the background.', 'twentyten' ) . '" /><figcaption><em>' . esc_html__( 'Relaxing at the lake after dinner', 'twentyten' ) . '</em></figcaption></figure><!-- /wp:image --></div><!-- /wp:column --></div><!-- /wp:columns -->',
)
);
}

View File

@ -40,18 +40,18 @@ if ( function_exists( 'register_block_pattern' ) ) {
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- wp:image {"align":"center","sizeSlug":"large","linkDestination":"none"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="' . esc_url( get_stylesheet_directory_uri() ) . '/images/pattern-jumble-2.jpg" alt="' . esc_attr__( 'Close up of a yellow and green leaf.', 'twentytwelve' ) . '" /></figure></div>
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/images/pattern-jumble-2.jpg" alt="' . esc_attr__( 'Close up of a yellow and green leaf.', 'twentytwelve' ) . '" /></figure></div>
<!-- /wp:image --></div>
<!-- /wp:column -->
<!-- wp:column {"width":"29%"} -->
<div class="wp-block-column" style="flex-basis:29%"><!-- wp:image {"align":"center","sizeSlug":"large","linkDestination":"none"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="' . esc_url( get_stylesheet_directory_uri() ) . '/images/pattern-jumble-3.jpg" alt="' . esc_attr__( 'Close up of a yellow leaf.', 'twentytwelve' ) . '" /></figure></div>
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/images/pattern-jumble-3.jpg" alt="' . esc_attr__( 'Close up of a yellow leaf.', 'twentytwelve' ) . '" /></figure></div>
<!-- /wp:image -->
<!-- wp:spacer {"height":25} -->
<div style="height:25px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image size-large"><img src="' . esc_url( get_stylesheet_directory_uri() ) . '/images/pattern-jumble-4.jpg" alt="' . esc_attr__( 'Close up of a yellow and green leaf.', 'twentytwelve' ) . '" /></figure>
<figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/images/pattern-jumble-4.jpg" alt="' . esc_attr__( 'Close up of a yellow and green leaf.', 'twentytwelve' ) . '" /></figure>
<!-- /wp:image --></div>
<!-- /wp:column -->
<!-- wp:column {"width":"43%"} -->
@ -59,7 +59,7 @@ if ( function_exists( 'register_block_pattern' ) ) {
<div style="height:37px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
<figure class="wp-block-image size-large"><img src="' . esc_url( get_stylesheet_directory_uri() ) . '/images/pattern-jumble-1.jpg" alt="' . esc_attr__( 'Close up of a yellow and green leaf.', 'twentytwelve' ) . '" /></figure>
<figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/images/pattern-jumble-1.jpg" alt="' . esc_attr__( 'Close up of a yellow and green leaf.', 'twentytwelve' ) . '" /></figure>
<!-- /wp:image --></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div></div>
@ -92,7 +92,7 @@ if ( function_exists( 'register_block_pattern' ) ) {
'content' => '<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:image {"sizeSlug":"large","linkDestination":"none","className":"is-style-default"} -->
<figure class="wp-block-image size-large is-style-default"><img src="' . esc_url( get_stylesheet_directory_uri() ) . '/images/pattern-jumble-3.jpg" alt="' . esc_attr__( 'Close up of a yellow leaf.', 'twentytwelve' ) . '" /></figure>
<figure class="wp-block-image size-large is-style-default"><img src="' . esc_url( get_template_directory_uri() ) . '/images/pattern-jumble-3.jpg" alt="' . esc_attr__( 'Close up of a yellow leaf.', 'twentytwelve' ) . '" /></figure>
<!-- /wp:image --></div>
<!-- /wp:column -->
<!-- wp:column -->

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.8.1-alpha-51487';
$wp_version = '5.8.1-alpha-51488';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.