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

Patterns: allow patterns to set blockType and templateType #53396

Open
annezazu opened this issue Aug 7, 2023 · 5 comments
Open

Patterns: allow patterns to set blockType and templateType #53396

annezazu opened this issue Aug 7, 2023 · 5 comments
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced Needs Design Feedback Needs general design feedback. [Type] Enhancement A suggestion for improvement.

Comments

@annezazu
Copy link
Contributor

annezazu commented Aug 7, 2023

What problem does this address?

Similar to adding the ability to categorize patterns #53163, I think we should unlock the ability to designate patterns as starter content for templates, posts, pages, etc in line with having more curation options. For example, I could then create starter patterns for when I create new posts without needing to leave the editor or do anything in code!

What is your proposed solution?

Similar to being able to set a category in #53163, perhaps we can add a field for designating starter content.

@annezazu annezazu added Needs Design Feedback Needs general design feedback. [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced labels Aug 7, 2023
@annezazu annezazu added this to Patterns Aug 7, 2023
@mtias
Copy link
Member

mtias commented Aug 7, 2023

Isn't this captured already with the template argument on post types?— https://developer.wordpress.org/block-editor/reference-guides/block-api/block-templates/#custom-post-types

@annezazu
Copy link
Contributor Author

annezazu commented Aug 7, 2023

In my mind, it's just a matter of exposing the option so yes? 🤔 Are you saying it's already possible?

@kevin940726 kevin940726 moved this to Todo in Patterns Aug 9, 2023
@annezazu annezazu changed the title Patterns: allow patterns to be set as starter content Patterns: allow patterns to set blockType and templateType Aug 18, 2023
@jordesign jordesign added the [Type] Enhancement A suggestion for improvement. label Aug 30, 2023
@aaronrobertshaw aaronrobertshaw moved this from Todo to Needs Design in Patterns Sep 7, 2023
@bph
Copy link
Contributor

bph commented Feb 12, 2024

The context for this issue is, that it is possible for a theme developer to provide a set of patterns that show up in a modal for a new page. @justintadlock wrote a great introduction to how to create those on the Developer Blog. Adding starter patterns to your WordPress themes

This is only possible on a code level. In the site editor, the pattern creation process doesn't provide the interface to add a block type or a template type to the pattern, so it always would need multiple additional clicks and selection to create content with a certain template.

Another downside of the missing Interface is that if a user duplicates such a block type or template type patterns to make it a synched pattern with overrides, it also loosed the settings for page type or template type, and the great feature is lost.

@bph
Copy link
Contributor

bph commented Feb 12, 2024

@mtias pointed to a different kind of template, a block template feature that's been available since the early days of Gutenberg, that allows developers to restrict custom blocks that are used for Custom Post Types, and change their prompt.

@carstingaxion
Copy link
Contributor

I think both aspects have a little overlap. The by @annezazu mentioned blockType and templateType definition, if exist, will overrule an template definition from register_post_type() like pointed out by @mtias and further explained by @bph . This is not new and ok.

But, when a plugin defines one or more template blocks, like for e.g. gatherpress does, there is no no-code way to avoid this plugin-given default or to define something own.

For me personally, I would prefer having a UI to set or reset the one template defined in the post_type definition rather than prepare UI for the other two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced Needs Design Feedback Needs general design feedback. [Type] Enhancement A suggestion for improvement.
Projects
No open projects
Status: Needs Design
Development

No branches or pull requests

5 participants