Make WordPress Core


Ignore:
Timestamp:
07/26/2021 03:23:02 AM (3 years ago)
Author:
peterwilsoncc
Message:

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.

Location:
branches/5.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.8

  • branches/5.8/src/wp-content/themes/twentytwelve/inc/block-patterns.php

    r51033 r51488  
    4141                <!-- /wp:spacer -->
    4242                <!-- wp:image {"align":"center","sizeSlug":"large","linkDestination":"none"} -->
    43                 <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>
     43                <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>
    4444                <!-- /wp:image --></div>
    4545                <!-- /wp:column -->
    4646                <!-- wp:column {"width":"29%"} -->
    4747                <div class="wp-block-column" style="flex-basis:29%"><!-- wp:image {"align":"center","sizeSlug":"large","linkDestination":"none"} -->
    48                 <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>
     48                <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>
    4949                <!-- /wp:image -->
    5050                <!-- wp:spacer {"height":25} -->
     
    5252                <!-- /wp:spacer -->
    5353                <!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
    54                 <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>
     54                <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>
    5555                <!-- /wp:image --></div>
    5656                <!-- /wp:column -->
     
    6060                <!-- /wp:spacer -->
    6161                <!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
    62                 <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>
     62                <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>
    6363                <!-- /wp:image --></div>
    6464                <!-- /wp:column --></div>
     
    9393                <div class="wp-block-columns"><!-- wp:column -->
    9494                <div class="wp-block-column"><!-- wp:image {"sizeSlug":"large","linkDestination":"none","className":"is-style-default"} -->
    95                 <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>
     95                <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>
    9696                <!-- /wp:image --></div>
    9797                <!-- /wp:column -->
Note: See TracChangeset for help on using the changeset viewer.