Created
January 15, 2022 01:38
-
-
Save wpfangirl/a32bd64445f69f9a7a6c65e76a3343a7 to your computer and use it in GitHub Desktop.
Add a row to your block template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Adds the row block in an HTML template */ | |
<!-- wp:group {"layout":{"type":"flex","allowOrientation":false}} --> | |
<div class="wp-block-group"></div> | |
<!-- /wp:group --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Creates a post template and adds the "row" variation of a core group block | |
function myplugin_register_template() { | |
$post_type_object = get_post_type_object( 'post' ); | |
$post_type_object->template = array( | |
array( | |
'core/group', | |
array( | |
'layout' => array( | |
'type' => 'flex', | |
'allowOrientation' => false, | |
), | |
), | |
array(), | |
), | |
); | |
} | |
add_action( 'init', 'myplugin_register_template' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment