Skip to content

Commit

Permalink
Templates: Search for old template names in the parent theme too
Browse files Browse the repository at this point in the history
  • Loading branch information
scruffian committed Nov 26, 2021
1 parent 96a0daf commit f5cf1d2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/compat/wordpress-5.9/block-template-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ function get_block_theme_folders( $theme_stylesheet = null ) {
$root_dir = get_theme_root( $theme_name );
$theme_dir = "$root_dir/$theme_name";

if ( is_readable( $theme_dir . '/block-templates/index.html' ) ) {
$parent_theme_name = get_template();
$parent_root_dir = get_theme_root( $parent_theme_name );
$parent_theme_dir = "$parent_root_dir/$parent_theme_name";

if ( is_readable( $theme_dir . '/block-templates/index.html' ) || is_readable( $parent_theme_dir . '/block-templates/index.html' ) ) {
return array(
'wp_template' => 'block-templates',
'wp_template_part' => 'block-template-parts',
Expand Down

0 comments on commit f5cf1d2

Please sign in to comment.