Home › Forums › Add-ons › Repeater Field › How to group sub fields? › Reply To: How to group sub fields?
OK so it’s probably more a regular coding issue than an ACF one but would still be grateful for any suggestions on best way to approach working with rows of sub fields which can be handled in groups (for formatting etc). Multidimensional array maybe?
$name = get_sub_field(‘name’); // John Joan Ravi Devi Olaf Freya
$fruit = get_sub_field(‘fruit’); // apples oranges apples mangoes oranges apples
$when = get_sub_field(‘when’); // breakfast breakfast lunch dinner breakfast lunch
To get this (could be grouped either by fruit or time):
John likes apples at breakfast
Ravi likes apples at lunch
Freya likes apples at lunch
Joan likes oranges at breakfast
Olaf likes oranges at breakfast
Devi likes mangoes at dinner
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.