-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Template Parts with no HTML tags #49071
Comments
This is probably a duplicate of #36853. |
I will mark this as needing more information to proceed further as @talldan suggested. |
I tried this recently in #48471 It is not possible to remove the element in the editors, so the front and editor would not match, this was considered a blocker. It works on the front when the template part has no attributes. The template part has no styles like colors and padding on its own, but it has an option to add a class name, for example. |
What you're describing there sounds more like a reusable block, not a template part... You can use reusable blocks already for things like that. They don't add a wrapping element, and their purpose is to do just that: group commonly reused components. |
Our end product needs to be self-contained, we can't rely on creating reusable block posts in the database or bundling WXR imports with the theme to enable basic functionality.
@carolinan do you have any details on what the blocker is? I'm seeing lots of references to the editor needing the wrapper, but nothing that says why or explains the problem |
@tomjn, the block editor marks a group of elements as a block using a wrapper element. It's usually done by using the |
Do reusable blocks not use that too?
|
The reusable blocks also have a wrapper element in the editor, but there's no wrapper element when rendered on the front. |
hmm could template parts do the same then? @carolinan's PR could be modified to do that easily, this part in particular https://github.com/WordPress/gutenberg/pull/48471/files#diff-28f36bb64fbbc8ce728db401b1e4cf30c9f44db7f5dcce1b7b0cc9ce60b1a209R169-R171 |
Hmmmm I see... maybe patterns could do the job then? They are self-contained in the theme and not saved in the database. They have the difference that they can be edited after getting imported, but perhaps for your scenario that's not a deal-breaker? |
Help us move this issue forward. This issue is being marked stale since it has no activity after 15 days of requesting more information. Please add info requested so we can help move the issue forward. Note: The triage policy is to close stale issues that need more info and no response after 2 weeks. |
What problem does this address?
Sometimes it's useful to put commonly reused components in a template part, but template parts have a tag such as a
<div>
and this breaks markup/styling.What is your proposed solution?
Tag-less template parts!
A "None" option in this dropdown would do the job:
The text was updated successfully, but these errors were encountered: