Home Forums Add-ons Repeater Field Use InnerBlocks inside Repeater field Reply To: Use InnerBlocks inside Repeater field

  • @alessietto simplified you need to change your markup.
    this is my first block type “tabgroup”:

    <div class="tabgroup" id="<?php echo $block_id; ?>">
        <InnerBlocks allowedBlocks="<?php echo esc_attr( wp_json_encode( array( 'tabitem' ) ) );?>" template="<?php echo esc_attr( wp_json_encode( array(array('tabitem')) ) );?>" />

    this is my second block type “tabitem” which is a child of tab_group:

    <div class="tabitem">
        <InnerBlocks />

    tabitem needs the json-key:
    "parent" : ["tabgroup"]

    or if you work oldschool with php array:
    "parent" => array("tabgroup")

    in the end you need to order the items and play with visibility via css like:
    .tabwrapper { display:flex }
    .tabitem { order: 0 }
    .tabgroup { order: 1 }

    check this article to understand the logic