Replies: 2 comments 6 replies
-
|
Sorry for the delay in replying. Adding a |
Beta Was this translation helpful? Give feedback.
4 replies
-
|
To register a block template part from a plugin, you can use the You can do it like this: add_action( 'init', function() {
register_block_template_part(
'my-plugin/header',
array(
'title' => 'Plugin Header',
'description' => 'Header template part added by my plugin.',
'area' => 'header',
'content' => '<!-- wp:paragraph --><p>This is my custom header</p><!-- /wp:paragraph -->',
)
);
});Make sure:
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Since WordPress 6.7, there's a new
register_block_templateAPI which can be used by plugins to register a custom block template.But how can we add a block template part from plugins?
Beta Was this translation helpful? Give feedback.
All reactions