Skip to content

Instantly share code, notes, and snippets.

@wpfangirl
Created January 15, 2022 01:38
Show Gist options
  • Select an option

  • Save wpfangirl/a32bd64445f69f9a7a6c65e76a3343a7 to your computer and use it in GitHub Desktop.

Select an option

Save wpfangirl/a32bd64445f69f9a7a6c65e76a3343a7 to your computer and use it in GitHub Desktop.

Revisions

  1. wpfangirl created this gist Jan 15, 2022.
    4 changes: 4 additions & 0 deletions template.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    /* Adds the row block in an HTML template */
    <!-- wp:group {"layout":{"type":"flex","allowOrientation":false}} -->
    <div class="wp-block-group"></div>
    <!-- /wp:group -->
    17 changes: 17 additions & 0 deletions templates.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    // 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' );