-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Hide "Create template part" menu from block settings dropdown for classic themes #65568
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
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +11 B (0%) Total Size: 1.85 MB
ℹ️ View Unchanged
|
Given template parts can be used and called directly in PHP templates, I'm not sure this should be disallowed entirely. At the very least, the "is block theme" check seems a bit too broad, we should be checking on |
In my opinion, the fact that we have to add code to PHP templates is a problem in itself. It seems inconsistent that we can add template parts via the UI, but then have to write code to display them. Additionally, when adding a template part in a PHP template, we need to add code like There had been ongoing efforts to prohibit the creation of template parts in classic themes. This PR fixes the exceptions that are not in line with this effort. If the creation of template parts should be allowed, I think all of these places need to be changed at the same time in a follow-up. |
Yeah, I lean towards allowing creating template parts if the theme is adding support for them, and things like slug editing should also be exposed. On classic themes there are a lot of elements that can be created in the UI, but won't be displayed unless there is code added to the PHP template (creating meta fields, widget areas, etc). Curious about other thoughts, though. |
I don't have a strong opinion on this but it seems quite harmless as is on trunk. Maybe folks with more experience in themes can chime in -cc @carolinan @MaggieCabrera . |
Now on the other hand, it may not need to be prioritized unless more people and more users speak up, or if there are many new support requests, since there is a suggestion to unify template parts and synced patterns. |
As I understand it, there are two things expected of a classic theme with
In any case, I think creating template parts via the UI should be prohibited in classic themes. For example: "Add New Template Part" menu item in the site editor: gutenberg/packages/edit-site/src/components/add-new-pattern/index.js Lines 99 to 105 in 2fc05aa
"Start blank" button of the Template Part block:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @t-hamano!
…ssic themes (WordPress#65568) Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: mtias <matveb@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org> Co-authored-by: carolinan <poena@git.wordpress.org>
What?
I noticed that in classic themes, template parts can be created unintentionally in certain scenarios:
Why?
Classic themes don't allow us to insert template parts via the post editor or site editor, so we should always hide this menu.
How?
Add
isBlockTheme
check.Testing Instructions