Themes: Accept valid block themes.
Updates theme validation to accept block themes. This replaces the requirement for an `index.php` with a requirement for either an `index.php`, `/templates/index.html` or the deprecated `/block-templates/index.html`. Validation is updated for theme uploads, within `WP_Theme::__construct` and `validate_current_theme()`. A block theme using the deprecated file structure is now included in the unit tests. Props peterwilsoncc, sergeybiryukov, hellofromtonya, costdev, azaozz, gziolo, FlorianBrinkmann, Boniu91, aristath, poena, audrasjb. Fixes #55754. Built from https://develop.svn.wordpress.org/trunk@53416 git-svn-id: http://core.svn.wordpress.org/trunk@53005 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -341,7 +341,9 @@ final class WP_Theme implements ArrayAccess {
|
||||
$this->template = $this->stylesheet;
|
||||
$theme_path = $this->theme_root . '/' . $this->stylesheet;
|
||||
|
||||
if ( ! file_exists( $theme_path . '/templates/index.html' )
|
||||
if (
|
||||
! file_exists( $theme_path . '/templates/index.html' )
|
||||
&& ! file_exists( $theme_path . '/block-templates/index.html' ) // Deprecated path support since 5.9.0.
|
||||
&& ! file_exists( $theme_path . '/index.php' )
|
||||
) {
|
||||
$error_message = sprintf(
|
||||
|
||||
Reference in New Issue
Block a user