Gutenberg Block Template for Page Template or Category
-
I’ve read the documentation for defining block templates and locking the layout by post type (i.e. by post, page, or custom-post), but is it possible to define the layout by post_meta data like page template or post category?
function myplugin_register_template() { $post_type_object = get_post_type_object( 'post' ); $post_type_object->template = array( array( 'core/paragraph', array( 'placeholder' => 'Add Description...', ) ), ); $post_type_object->template_lock = 'all'; } add_action( 'init', 'myplugin_register_template' );
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Gutenberg Block Template for Page Template or Category’ is closed to new replies.