-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Open
Labels
Needs Design FeedbackNeeds general design feedback.Needs general design feedback.Needs DevReady for, and needs developer effortsReady for, and needs developer efforts[Block] Template PartAffects the Template Parts BlockAffects the Template Parts Block[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Description
Description
Define your own template part area. Then, create multiple template parts that belong to that area. Open the site editor and insert one of the template parts you created.
At this point, in WordPress 6.0, you will see "Replace" in the toolbar of that template part, but not in 6.1.
It does not appear even after activating the Gutenberg plugin.
Step-by-step reproduction instructions
Since it is necessary to define the template parts area and create the template parts file, TT2 is used as an example.
1. Add code to functions.php.
function tt2_default_wp_template_part_areas( $default_area_definitions ) {
return array_merge(
$default_area_definitions,
array(
array(
'area' => 'tt2/template-part/test',
'label' => 'Test template parts',
'icon' => 'layout',
'description' => '',
'area_tag' => 'div',
),
)
);
}
add_filter( 'default_wp_template_part_areas', 'tt2_default_wp_template_part_areas' );
2. Create template parts.
Open /parts. And create this files.
/parts/test-1.html
<!-- wp:paragraph -->
<p>Test 1</p>
<!-- /wp:paragraph -->
/parts/test-2.html
<!-- wp:paragraph -->
<p>Test 2</p>
<!-- /wp:paragraph -->
3. Add code to theme.json.
"templateParts": [
// omission,
{
"name": "test-1",
"title": "Test 1",
"area": "tt2/template-part/test"
},
{
"name": "test-2",
"title": "Test 2",
"area": "tt2/template-part/test"
}
]
4. Add template part on the site editor.
In 6.0, "Replace" appears on the toolbar.
Not shown in 6.1.
Screenshots, screen recording, code snippet
No response
Environment info
- WordPress 6.1 beta3
- WordPress 6.0.2
- Gutenberg 14.2.0
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
webmandesign, spstrap and onetrevddryo and spstrap
Metadata
Metadata
Assignees
Labels
Needs Design FeedbackNeeds general design feedback.Needs general design feedback.Needs DevReady for, and needs developer effortsReady for, and needs developer efforts[Block] Template PartAffects the Template Parts BlockAffects the Template Parts Block[Type] EnhancementA suggestion for improvement.A suggestion for improvement.




