Support

Account

Home Forums Gutenberg Repeater Field Show First Row in Gutenberg Template

Unread

Repeater Field Show First Row in Gutenberg Template

  • Hello,

    I’m working on a custom Gutenberg column block and I’ve run into a bit of a snag. I have my column block working fine but I now want it to be the default block on all Pages, so I’m using this code:

    function pages_guten_template() {
        $post_type_object = get_post_type_object( 'page' );
        $post_type_object->template = array(
            array( 'acf/multi-columns' ),
        );
    }
    add_action( 'init', 'pages_guten_template' );

    However, when I go to add a new Page, I want the first row of my repeater to show (I’ve configured the ACF settings to force at least 1 row to be displayed). This is what I see when I add a new Page:
    New Page Template

    Conversely, when I add my block manually into a page, the first row of the repeater is shown:
    Manual Repeater Block Addition

    Is there a way, perhaps via javascript, to get my repeater to display the first (default) row when it is used in the template? Otherwise it is hard for the user to identify the empty repeater as something that they can edit. Any help would be greatly appreciated!

Viewing 1 post (of 1 total)

The topic ‘Repeater Field Show First Row in Gutenberg Template’ is closed to new replies.