Changeset 56255 for trunk/src/wp-includes/blocks/template-part.php
- Timestamp:
- 07/18/2023 07:17:23 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/template-part.php
r56065 r56255 19 19 $content = null; 20 20 $area = WP_TEMPLATE_PART_AREA_UNCATEGORIZED; 21 $stylesheet = get_stylesheet();22 21 23 22 if ( 24 23 isset( $attributes['slug'] ) && 25 24 isset( $attributes['theme'] ) && 26 $stylesheet=== $attributes['theme']25 get_stylesheet() === $attributes['theme'] 27 26 ) { 28 27 $template_part_id = $attributes['theme'] . '//' . $attributes['slug']; … … 65 64 do_action( 'render_block_core_template_part_post', $template_part_id, $attributes, $template_part_post, $content ); 66 65 } else { 66 $template_part_file_path = ''; 67 67 // Else, if the template part was provided by the active theme, 68 68 // render the corresponding file content. 69 69 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']; 83 77 } 84 78 }
Note: See TracChangeset
for help on using the changeset viewer.