Make WordPress Core


Ignore:
Timestamp:
07/24/2021 12:40:28 PM (3 years ago)
Author:
SergeyBiryukov
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.
Fixes #53769.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyeleven/inc/block-patterns.php

    r51434 r51483  
    4040                <div class="wp-block-columns"><!-- wp:column -->
    4141                <div class="wp-block-column"><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} -->
    42                 <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>
     42                <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>
    4343                <!-- /wp:image -->
    4444                <!-- wp:paragraph {"dropCap":true} -->
     
    118118                <div class="wp-block-columns"><!-- wp:column -->
    119119                <div class="wp-block-column"><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} -->
    120                 <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>
     120                <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>
    121121                <!-- /wp:image --></div>
    122122                <!-- /wp:column -->
Note: See TracChangeset for help on using the changeset viewer.