Home › Forums › Add-ons › Repeater Field › Gallery with main picture and thumbnails › Reply To: Gallery with main picture and thumbnails
Hey,
You can add a single image field to get the first preview image and then add the repeater field to get all images.
See below.
<div class="col-left">
<img class="xzoom" src="<?php the_field('preview_image'); ?>" xoriginal="<?php echo the_field('preview_image'); ?>" />
<?php
if( have_rows('main_gallery') ):
while ( have_rows('main_gallery') ) : the_row();
<div class="xzoom-thumbs">
<a href="<?php the_sub_field('image_preview') ?>">
<img class="xzoom-gallery" width="80" src="<?php the_sub_field('image_thumb'); ?>" xpreview="<?php the_sub_field('image_preview'); ?>">
</a>
</div>
<?php
endwhile;
endif;
?>
</div>
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.