Make WordPress Core


Ignore:
Timestamp:
07/18/2023 07:17:23 AM (2 years ago)
Author:
isabel_brison
Message:

Editor: update npm packages with second round of bug fixes for 6.3 RC1.

Includes miscellaneous bug fixes for 6.3 RC1.

Props ramonopoly, mukesh27.
Fixes #58804.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks/template-part.php

    r56065 r56255  
    1919    $content          = null;
    2020    $area             = WP_TEMPLATE_PART_AREA_UNCATEGORIZED;
    21     $stylesheet       = get_stylesheet();
    2221
    2322    if (
    2423        isset( $attributes['slug'] ) &&
    2524        isset( $attributes['theme'] ) &&
    26         $stylesheet === $attributes['theme']
     25        get_stylesheet() === $attributes['theme']
    2726    ) {
    2827        $template_part_id    = $attributes['theme'] . '//' . $attributes['slug'];
     
    6564            do_action( 'render_block_core_template_part_post', $template_part_id, $attributes, $template_part_post, $content );
    6665        } else {
     66            $template_part_file_path = '';
    6767            // Else, if the template part was provided by the active theme,
    6868            // render the corresponding file content.
    6969            if ( 0 === validate_file( $attributes['slug'] ) ) {
    70                 $themes   = array( $stylesheet );
    71                 $template = get_template();
    72                 if ( $stylesheet !== $template ) {
    73                     $themes[] = $template;
    74                 }
    75 
    76                 foreach ( $themes as $theme ) {
    77                     $theme_folders           = get_block_theme_folders( $theme );
    78                     $template_part_file_path = get_theme_file_path( '/' . $theme_folders['wp_template_part'] . '/' . $attributes['slug'] . '.html' );
    79                     if ( file_exists( $template_part_file_path ) ) {
    80                         $content = (string) file_get_contents( $template_part_file_path );
    81                         $content = '' !== $content ? _inject_theme_attribute_in_block_template_content( $content ) : '';
    82                         break;
     70                $block_template_file = _get_block_template_file( 'wp_template_part', $attributes['slug'] );
     71                if ( $block_template_file ) {
     72                    $template_part_file_path = $block_template_file['path'];
     73                    $content                 = (string) file_get_contents( $template_part_file_path );
     74                    $content                 = '' !== $content ? _inject_theme_attribute_in_block_template_content( $content ) : '';
     75                    if ( isset( $block_template_file['area'] ) ) {
     76                        $area = $block_template_file['area'];
    8377                    }
    8478                }
Note: See TracChangeset for help on using the changeset viewer.