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/twentyeleven/inc/block-patterns.php

    r51406 r51488  
    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.