Changeset 56621 for trunk/src/wp-includes/block-template-utils.php
- Timestamp:
- 09/19/2023 04:15:52 PM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-template-utils.php
r56620 r56621 38 38 */ 39 39 function get_block_theme_folders( $theme_stylesheet = null ) { 40 $theme_name = null === $theme_stylesheet ? get_stylesheet() : $theme_stylesheet; 41 $root_dir = get_theme_root( $theme_name ); 42 $theme_dir = "$root_dir/$theme_name"; 43 44 if ( file_exists( $theme_dir . '/block-templates' ) || file_exists( $theme_dir . '/block-template-parts' ) ) { 40 $theme = wp_get_theme( (string) $theme_stylesheet ); 41 if ( ! $theme->exists() ) { 42 // Return the default folders if the theme doesn't exist. 45 43 return array( 46 'wp_template' => ' block-templates',47 'wp_template_part' => ' block-template-parts',44 'wp_template' => 'templates', 45 'wp_template_part' => 'parts', 48 46 ); 49 47 } 50 51 return array( 52 'wp_template' => 'templates', 53 'wp_template_part' => 'parts', 54 ); 48 return $theme->get_block_template_folders(); 55 49 } 56 50
Note: See TracChangeset
for help on using the changeset viewer.