-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Docs: Template registration from a plugin #64495
Comments
I'm not sure this should live in the "theme handbook". Theme register templates by adding files to the templates folder. This is more for plugin authors. So maybe a guide would be better. |
You're right! 🤦♂️ From there, maybe we could add a new How-to-guide at Block Editor Handbook > How-to Guides explaining how to register templates, template parts, and any other theme-related stuff that can be registered from a plugin. This page could be just about introducing resources on other parts of wordpress.org (like articles in the developer blog) |
Agreed that this new feature, at least in its current form, is specific to plugins registering templates.
Just noting that the It might not be a bad idea to document that in the Theme Handbook as well. |
Isn't this what the "customTemplates" in theme.json is about (at least for the title and postTypes config) |
That's only for custom post/page/CPT templates. It doesn't work for entirely custom templates. For example, suppose I wanted to allow for a version of single templates based on post formats (e.g., |
A new registration API for templates (
wp_register_block_template
) function has been merged. This new API allows extenders to register templates and template parts from a custom plugin or theme. It also allows extender to assign a template to a custom type (among other things)There should be some guide or documentation in the Handbooks about this new way of registering templates.
At first glance, a new page called "Registering Templates" under Theme Handbook > Templates seems to be a good place for such a guide.
cc: @justintadlock @youknowriad
The text was updated successfully, but these errors were encountered: