Home › Forums › Add-ons › Repeater Field › looping nested repeaters › Reply To: looping nested repeaters
the first problem I see is that you are trying to use get_sub_field()
outside of a have_rows()
loop.
correct loop using have_rows()
if (have_rows('collections')) {
while (have_rows('collections')) {
the_row();
$banners = get_sub_field('banners');
}
}
correct loop using array
$collections = get_field('collections');
foreach ($collections as $collection) {
$banners = $collection['banners'];
}
The other thing is this $banners.count();
should be count($banners)
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.