Home › Forums › Add-ons › Repeater Field › How to get the count of a child field inside a nested repeater › Reply To: How to get the count of a child field inside a nested repeater
To get the number of rows you need to get the count of the repeater instead of the count of a sub field of that repeater. You need to get the count in the parent before your call have_rows
for the parent. The reason for this is that ‘child_repeater’ is not a sub field of child_repeater
while( have_rows('parent_repeater') ) : the_row();
// ...
$count = count(get_sub_field('child_repeater'));
if( have_rows('child_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 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.