Make WordPress Core


Ignore:
Timestamp:
03/16/2022 06:28:46 PM (4 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/theme.php

    r52828 r52940  
    831831
    832832/**
    833  * Checks that the active theme has 'index.php' and 'style.css' files.
     833 * Checks that the active theme has the required files.
     834 *
     835 * Standalone themes need to have a `templates/index.html` or `index.php` template file.
     836 * Child themes need to have a `Template` header in the `style.css` stylesheet.
    834837 *
    835838 * Does not initially check the default theme, which is the fallback and should always exist.
     
    841844 *
    842845 * @since 1.5.0
     846 * @since 6.0.0 Removed the requirement for block themes to have an `index.php` template.
    843847 *
    844848 * @see WP_DEFAULT_THEME
     
    858862    }
    859863
    860     if ( ! file_exists( get_template_directory() . '/index.php' ) ) {
     864    if ( ! file_exists( get_template_directory() . '/templates/index.html' )
     865        && ! file_exists( get_template_directory() . '/index.php' )
     866    ) {
    861867        // Invalid.
    862868    } elseif ( ! file_exists( get_template_directory() . '/style.css' ) ) {
Note: See TracChangeset for help on using the changeset viewer.