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')) ) );?>" />
</div>
this is my second block type “tabitem” which is a child of tab_group:
<div class="tabitem">
<InnerBlocks />
</div>
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
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.