Editor: Activate missing default theme features for block themes.

By default, block themes should have a few theme supports enabled by default. These are: `post-thumbnails`, `responsive-embeds`, `editor-styles`, `html5`, `automatic-feed-links`. This changeset backports the changes introduced in https://github.com/WordPress/gutenberg/pull/35593.

Props noisysocks, ocean90, youknowriad, audrasjb, hellofromTonya.
Fixes #54597.


git-svn-id: https://develop.svn.wordpress.org/trunk@52369 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jb Audras 2021-12-14 09:47:51 +00:00
parent 11753b9481
commit 46d21eb99a
2 changed files with 18 additions and 0 deletions

View File

@ -514,6 +514,7 @@ add_action( 'init', 'wp_sitemaps_get_server' );
*/
// Theme.
add_action( 'setup_theme', 'create_initial_theme_features', 0 );
add_action( 'setup_theme', '_add_default_theme_supports', 1 );
add_action( 'wp_loaded', '_custom_header_background_just_in_time' );
add_action( 'wp_head', '_custom_logo_header_styles' );
add_action( 'plugins_loaded', '_wp_customize_include' );

View File

@ -4164,3 +4164,20 @@ function create_initial_theme_features() {
function wp_is_block_theme() {
return wp_get_theme()->is_block_theme();
}
/**
* Adds default theme supports for block themes when the 'setup_theme' action fires.
*
* @since 5.9.0
* @access private
*/
function _add_default_theme_supports() {
if ( wp_is_block_theme() ) {
add_theme_support( 'post-thumbnails' );
add_theme_support( 'responsive-embeds' );
add_theme_support( 'editor-styles' );
add_theme_support( 'html5', array( 'comment-form', 'comment-list', 'style', 'script' ) );
add_theme_support( 'automatic-feed-links' );
add_filter( 'should_load_separate_core_block_assets', '__return_true' );
}
}