Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parts assigned to their own area do not appear in the site editor library. #52101

Closed
inc2734 opened this issue Jun 29, 2023 · 2 comments · Fixed by #52159
Closed

Parts assigned to their own area do not appear in the site editor library. #52101

inc2734 opened this issue Jun 29, 2023 · 2 comments · Fixed by #52159
Assignees
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Type] Bug An existing feature does not function as intended

Comments

@inc2734
Copy link
Contributor

inc2734 commented Jun 29, 2023

Description

Areas added with filter hooks do not appear in the site editor library. Template parts assigned to that area do not appear in the list even if they are created.

Code to add an area

function my_default_wp_template_part_areas( $default_area_definitions ) {
	return array_merge(
		$default_area_definitions,
		array(
			array(
				'area'        => 'my-area',
				'label'       => 'My Area',
				'icon'        => 'layout',
				'description' => '',
			),
		)
	);
}
add_filter( 'default_wp_template_part_areas', 'my_default_wp_template_part_areas' );

Step-by-step reproduction instructions

  • Add new area with the default_wp_template_part_areas filter hook.
  • Create a template part assigned to that area.
  • When we go to the library, we will see a list of template part areas, but not the unique area we added.
  • The number of template parts assigned to uncategorize is increasing, but they are not shown in the preview.
  • The same problem occurs whether template parts are created in the site editor or added to the parts directory.

Screenshots, screen recording, code snippet

Kapture.2023-06-29.at.14.30.20.mp4

Environment info

  • WordPress 6.3 beta2
  • Twenty Twenty-ThreeVersion: 1.1
  • Gutenberg 16.1.0 Enable/Disable

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

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") labels Jun 29, 2023
@ndiego ndiego moved this to 📥 Todo in WordPress 6.3.x Editor Tasks Jun 29, 2023
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jun 30, 2023
@github-project-automation github-project-automation bot moved this from 📥 Todo to ✅ Done in WordPress 6.3.x Editor Tasks Jul 3, 2023
@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label Jul 24, 2023
@bd-viget
Copy link

I may need to open a new issue for this, however after this has been added, I'm wondering why can't the template part just display under its own custom section, rather than having them all in General?

Screenshot 2023-10-25 at 4 34 23 PM

If I use the default_wp_template_part_areas filter to defined my own custom area, this should reflect in the FSE UI next to General, Header, and Footer.

And a side question, are our only options for icons layout, header, and footer? Is there no support for custom icons or passing an SVG value?

@bd-viget
Copy link

Another issue here is the value passed for area_tag is not honored. Using the following as an example:

function my_default_wp_template_part_areas( $default_area_definitions ) {
	return array_merge(
		$default_area_definitions,
		array(
			array(
				'area'        => 'my-area',
				'label'       => 'My Area',
				'icon'        => 'layout',
				'description' => '',
				'area_tag'    => 'nav',
			),
		)
	);
}
add_filter( 'default_wp_template_part_areas', 'my_default_wp_template_part_areas' );

In my use case, I'm using render_block_core_template_part and the tag used in the output is <div>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Type] Bug An existing feature does not function as intended
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

5 participants