My apologies if this has already been addressed elsewhere, however I can’t quite seem to find a solution even after looking at other people’s posts – that said I’m more of a learner in this area.
I’m looking to count the number of rows in a repeater field nested within a flexible content field. I want to append the count value to the class of the container that will wrap my repeater field rows.
I’ve successfully been able to call and echo the count if I use <?php echo count(get_sub_field('nested_repeater')); ?> after the loop that displays each row. That said, as soon as I try to do this within the class of the wrapper (before the loop), it returns a value of 1, no matter how many rows there are.
Anybody have any thoughts on how to count the number of rows outside/before the loop?
Thanks in advance; let me know if I can provide more info!