Home › Forums › Add-ons › Repeater Field › Use InnerBlocks inside Repeater field › Reply To: Use InnerBlocks inside Repeater field
I believe I’m right in saying that you can only include the <InnerBlocks /> tag once per block, so it wouldn’t really working in the repeater situation.
However, I believe you can still get the desired result with a slightly different approach. You’ll just need to use two custom blocks instead.
The first block, “tab group”, will look something like this:
<div class="group"> <InnerBlocks /> </div>
The second block, “tab item”, will look something like this:
<div class="item"> <InnerBlock /> </div>
The key is when you set the “tab group” block up that you define 'allowed_blocks'
to only allow “tab item” (acf/tab-item). Also, you can set the “tab item” up with 'parent'
to only allow it as an option when inside a “tab group”. Now, when you’re in the editor, you can firstly create a group block and then add as many unique item blocks to the group. Basically the same as a repeater!
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 demoed ACF 6.1 Beta during the most recent session of ACF Chat Fridays, highlighting the new ability to regenerate and clear labels, setting the Admin Menu Parent as a slug, and more. Catch the video replay in our latest summary. https://t.co/rHEpPVas64 pic.twitter.com/hB1XKTexXi
— Advanced Custom Fields (@wp_acf) March 23, 2023
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.