mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-05 13:14:29 +00:00
Themes: Allow block themes to be activated without index.php.
This removes the requirement for block themes to have an unused `index.php` template just for activation, as they use a `templates/index.html` file instead. The updated requirements are as follows: * Standalone themes need to have a `templates/index.html` or `index.php` template file. * Child themes need to have a `Template` header in the `style.css` stylesheet. Follow-up to [52069], [52247]. Props poena, sabbirshouvo, scruffian, manfcarlo, overclokk, andraganescu, SergeyBiryukov. Fixes #54272. git-svn-id: https://develop.svn.wordpress.org/trunk@52940 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -338,10 +338,15 @@ final class WP_Theme implements ArrayAccess {
|
||||
|
||||
if ( ! $this->template ) {
|
||||
$this->template = $this->stylesheet;
|
||||
if ( ! file_exists( $this->theme_root . '/' . $this->stylesheet . '/index.php' ) ) {
|
||||
$theme_path = $this->theme_root . '/' . $this->stylesheet;
|
||||
|
||||
if ( ! file_exists( $theme_path . '/templates/index.html' )
|
||||
&& ! file_exists( $theme_path . '/index.php' )
|
||||
) {
|
||||
$error_message = sprintf(
|
||||
/* translators: 1: index.php, 2: Documentation URL, 3: style.css */
|
||||
__( 'Template is missing. Standalone themes need to have a %1$s template file. <a href="%2$s">Child themes</a> need to have a Template header in the %3$s stylesheet.' ),
|
||||
/* translators: 1: templates/index.html, 2: index.php, 3: Documentation URL, 4: style.css */
|
||||
__( 'Template is missing. Standalone themes need to have a %1$s or %2$s template file. <a href="%3$s">Child themes</a> need to have a Template header in the %4$s stylesheet.' ),
|
||||
'<code>templates/index.html</code>',
|
||||
'<code>index.php</code>',
|
||||
__( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ),
|
||||
'<code>style.css</code>'
|
||||
|
||||
Reference in New Issue
Block a user