-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
What problem does this address?
Currently, templates are defined within the theme (source theme) and can be edited in the site editor (source custom). There are some use cases where plugins could also use the possibility to add a template. WooCommerce blocks plugin already adds templates for Product Catalog page, Product Page, etc. At MailPoet, we are considering using templates and templates parts for email templates.
WooCommerce Blocks developers documented how they added the templates. As you can see from the docs, adding a template is currently cumbersome.
What is your proposed solution?
This could be solved by adding an API for registering a template. I don't know the internals in detail, so I struggle with proposing the solution.
I was thinking about a function like:
/**
* @param WP_Block_Template
*/
function register_block_template( WP_Block_Template $template ) {}or maybe just
function register_block_template( array $args ) {}The $args would cover parameters for defining the block template.
It could be used for both templates and template_parts.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status