Code to display subfield of a repeater field in ACF
<?php if(get_field('slider_image')): ?> <?php while(has_sub_field('slider_image')): ?> <img src="<?php the_sub_field('image'); ?>" alt="" /> <?php endwhile; endif; ?>
Show only has subfield?
<?php while(has_sub_field('car_types')): ?> <div class="col-sm-12"> <div class="col-sm-6"> <?php the_sub_field('name'); ?> </div> <div class="col-sm-6"> <?php the_sub_field('price'); ?><br /> <?php $name = get_sub_field('brochure_file'); if (get_sub_field('brochure_file')) { ?> <a href="<?php the_sub_field('brochure_file'); ?>">Download Brochure</a> <?php } else { echo ''; } ?> </div> </div> <?php endwhile; endif; ?>
Repeater on Option
<?php while(has_sub_field('top_banner', 'option')): ?> <div> <a href="<?php the_sub_field('link'); ?>" target="_blank"> <img src="<?php the_sub_field('image'); ?>" /></a> </div> <?php endwhile; ?>