Themes: Update the base folders for templates and template parts in block themes.

Block Themes should now use the following folders:

 - templates instead of block-templates
 - parts instead of block-template-parts

Existing themes and folders will continue to work without impact.

Props bernhard-reiter.
Fixes #54493.


git-svn-id: https://develop.svn.wordpress.org/trunk@52247 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Riad Benguella
2021-11-25 10:57:19 +00:00
parent 90cdaabd2f
commit b90fc1b6dd
7 changed files with 40 additions and 17 deletions
+4 -4
View File
@@ -37,7 +37,7 @@ class Block_Template_Test extends WP_UnitTestCase {
);
$resolved_template_path = locate_block_template( get_stylesheet_directory() . '/page-home.php', $type, $templates );
$this->assertEquals( self::$template_canvas_path, $resolved_template_path );
$this->assertStringEqualsFile( get_stylesheet_directory() . '/block-templates/page-home.html', $_wp_current_template_content );
$this->assertStringEqualsFile( get_stylesheet_directory() . '/templates/page-home.html', $_wp_current_template_content );
}
function test_page_block_template_takes_precedence() {
@@ -50,7 +50,7 @@ class Block_Template_Test extends WP_UnitTestCase {
);
$resolved_template_path = locate_block_template( get_stylesheet_directory() . '/page.php', $type, $templates );
$this->assertEquals( self::$template_canvas_path, $resolved_template_path );
$this->assertStringEqualsFile( get_stylesheet_directory() . '/block-templates/page.html', $_wp_current_template_content );
$this->assertStringEqualsFile( get_stylesheet_directory() . '/templates/page.html', $_wp_current_template_content );
}
function test_block_template_takes_precedence_over_equally_specific_php_template() {
@@ -61,7 +61,7 @@ class Block_Template_Test extends WP_UnitTestCase {
);
$resolved_template_path = locate_block_template( get_stylesheet_directory() . '/index.php', $type, $templates );
$this->assertEquals( self::$template_canvas_path, $resolved_template_path );
$this->assertStringEqualsFile( get_stylesheet_directory() . '/block-templates/index.html', $_wp_current_template_content );
$this->assertStringEqualsFile( get_stylesheet_directory() . '/templates/index.html', $_wp_current_template_content );
}
/**
@@ -128,7 +128,7 @@ class Block_Template_Test extends WP_UnitTestCase {
);
$resolved_template_path = locate_block_template( $parent_theme_page_template_path, $type, $templates );
$this->assertEquals( self::$template_canvas_path, $resolved_template_path );
$this->assertStringEqualsFile( get_stylesheet_directory() . '/block-templates/page-1.html', $_wp_current_template_content );
$this->assertStringEqualsFile( get_stylesheet_directory() . '/templates/page-1.html', $_wp_current_template_content );
}
/**