ACF Repeater field
pobranie ilości pól w ACF Repeater field i zamknięcie co 2 boksy w divie/article przez wykorzystanie count(get_sub_field(’menu_description’))
<?php $fullFields = count(get_sub_field('menu_description'))-1; ?> <?php if( have_rows('menu_description') ): ?> <?php $i = 0; while( have_rows('menu_description') ): the_row();?> <?php if ( $i == 0 ) : ?> <article class="clear"> <?php endif; ?> <?php if ( $i !== 0 && $i%2 == 0 ) : ?> </article> <article class="clear"> <?php endif; ?> <div class="menubox"> <h5 class="dish-price"><?php the_sub_field('price'); ?></h5> <h5 class="dish-name"><?php the_sub_field('name'); ?></h5> <?php the_sub_field('description'); ?> </div> <?php if ($i == $fullFields) : ?> </article> <?php endif; ?> <?php $i++; endwhile;?> <?php endif; ?>
—
Hope this helps and happy coding :)