Open annezazu opened 1 year ago
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
In my mind, it's just a matter of exposing the option so yes? 🤔 Are you saying it's already possible?
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.
@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.
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.
What problem does this address?
Similar to adding the ability to categorize patterns https://github.com/WordPress/gutenberg/pull/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 https://github.com/WordPress/gutenberg/pull/53163, perhaps we can add a field for designating starter content.