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

Allow non-block themes with template parts support to create custom template parts in the Site Editor #51099

Closed
aurooba opened this issue May 30, 2023 · 4 comments
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Feature] Templates API Related to API powering block template functionality in the Site Editor [Focus] Blocks Adoption For issues that directly impact the ability to adopt features of Gutenberg. [Type] Enhancement A suggestion for improvement.

Comments

@aurooba
Copy link
Member

aurooba commented May 30, 2023

What problem does this address?

Right now, if your theme is not a block theme, you don't have the ability to create general template parts from the Site Editor. The only template parts you have access to are the ones added in your theme. It would be very helpful from a content administration perspective to be able to create custom template parts that could be used in other places.

What is your proposed solution?

I could see this being solved by the upcoming Library esque feature combined with more powerful patterns that you can create/edit without diving into the code, as well. But I do think the ability to create general template parts in the site editor should be an opt-in setting for themes. It would solve quite a few workflow issues.

@aurooba aurooba added [Feature] Templates API Related to API powering block template functionality in the Site Editor [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") labels Jun 7, 2023
@t-hamano
Copy link
Contributor

My understanding is that in non-blocking themes (classic themes with theme.json), the inability to create template parts in the Site Editor is intentional.

Even if we are able to create a new template parts in the Site Editor, it must be injected into a PHP-based theme template file in order to be displayed on the front end. Furthermore, since the slug for template parts created in the Site Editor is automatically generated, many people are confused about what slug to specify as the argument to the block_template_part() function.

In other words, we cannot completely manage template parts only in the Site Editor, as we can in the block editor. I think this is the reason why non-blocking themes cannot create template parts in the Site Editor.

@carolinan

Do you know anything about this issue?

@jordesign
Copy link
Contributor

With Synced Patterns being introduced - is there any reason that can't be used instead of introducing the ability to add a Template Part?

@jordesign jordesign added the [Type] Enhancement A suggestion for improvement. label Jul 19, 2023
@aaronrobertshaw aaronrobertshaw moved this to Todo in Patterns Aug 3, 2023
@annezazu annezazu added the [Focus] Blocks Adoption For issues that directly impact the ability to adopt features of Gutenberg. label Aug 15, 2023
@t-hamano
Copy link
Contributor

I just wanted to check the status of this issue.

The latest version of Gutenberg allows you to create sunced/unsynced patterns and also assign pattern categories. My understanding is that it is intentional that non-block-based themes do not allow the creation of template parts.

By the way, I would like to mention that there is also #52150, which aims to allow non-block-based themes to access the Site Editor's pattern UI.

@t-hamano
Copy link
Contributor

As mentioned in this comment, I think this is the intended design. I'd like to close this issue, but if there's anything I've missed, please feel free to comment.

@t-hamano t-hamano closed this as not planned Won't fix, can't repro, duplicate, stale Dec 29, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in Patterns Dec 29, 2023
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") [Feature] Templates API Related to API powering block template functionality in the Site Editor [Focus] Blocks Adoption For issues that directly impact the ability to adopt features of Gutenberg. [Type] Enhancement A suggestion for improvement.
Projects
No open projects
Status: Done
Development

No branches or pull requests

4 participants