mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Themes: Introduces block-based template parts for Classic themes.
Allows Classic / Hybrid themes to use block-based template parts without using complete block-based templates.
* Exposes the Site Editor's template parts UI
* Adds Appearance > "Template Parts" menu
* Enabled within the theme via adding a theme support for `'block-template-parts'`
{{{#!php
add_theme_support( 'block-template-parts' );
}}}
This is a backport from Gutenberg.[https://github.com/WordPress/gutenberg/pull/42729 See WordPress/gutenberg PR 42729].
Follow-up to [52330], [52069], [52178].
Props mamaduka, fabiankaegy, poena, scruffian, manfcarlo, bernhard-reiter, hellofromTonya.
See #56467.
git-svn-id: https://develop.svn.wordpress.org/trunk@54176 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -214,12 +214,20 @@ if ( wp_is_block_theme() ) {
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! wp_is_block_theme() && current_theme_supports( 'block-template-parts' ) ) {
|
||||
$submenu['themes.php'][6] = array(
|
||||
__( 'Template Parts' ),
|
||||
'edit_theme_options',
|
||||
'site-editor.php?postType=wp_template_part',
|
||||
);
|
||||
}
|
||||
|
||||
$customize_url = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' );
|
||||
|
||||
// Hide Customize link on block themes unless a plugin or theme
|
||||
// is using 'customize_register' to add a setting.
|
||||
if ( ! wp_is_block_theme() || has_action( 'customize_register' ) ) {
|
||||
$position = wp_is_block_theme() ? 7 : 6;
|
||||
$position = ( wp_is_block_theme() || current_theme_supports( 'block-template-parts' ) ) ? 7 : 6;
|
||||
|
||||
$submenu['themes.php'][ $position ] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user