Skip to content

Instantly share code, notes, and snippets.

@wpfangirl
Created January 15, 2022 01:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpfangirl/a32bd64445f69f9a7a6c65e76a3343a7 to your computer and use it in GitHub Desktop.
Save wpfangirl/a32bd64445f69f9a7a6c65e76a3343a7 to your computer and use it in GitHub Desktop.
Add a row to your block template
/* Adds the row block in an HTML template */
<!-- wp:group {"layout":{"type":"flex","allowOrientation":false}} -->
<div class="wp-block-group"></div>
<!-- /wp:group -->
// 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