I have a flexible content field set up with just one type of layout. I need to get the total count of layouts but my count is only returning 1 every time. Here is the ACF field setup:
And here is my code. Even when I add more than one table the count outputs 1.
<?php if( have_rows('pricing_tables') ): ?>
<div class="columns">
<?php while ( have_rows('pricing_tables') ) : the_row(); ?>
<?php if( get_row_layout() == 'price_table' ): ?>
<?php $count = count(get_sub_field('price_table')); ?>
<div class="one-half first count-<?php echo $count; ?> index-<?php echo get_row_index(); ?>">
<?php the_sub_field('title'); ?>
</div>
<?php endif; ?>
<?php endwhile; ?>
</div>
<?php endif; ?>
Can anyone help?