Home › Forums › Add-ons › Repeater Field › Repeater Galleries › Reply To: Repeater Galleries
<?php if( have_rows('gallery-repeater') ): ?>
<!-- CHECK TO SEE IF IT HAS ROWS IN IT -->
<?php while ( have_rows('gallery-repeater') ) : the_row(); ?>
<!-- DISPLAY THE TEXT-FIELD THEN ASSIGN OUR GALLERY TO VARIABLE $images -->
<?php the_sub_field('gallery-name');
$images = get_sub_field('gallery-images');
if( $images ):?>
<?php foreach( $images as $image ): ?>
<a href="<?php echo $image['url']; ?>">
<img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" />
</a>
<p><?php echo $image['caption']; ?></p>
<?php endforeach; ?>
<?php endif;
endwhile;
else :
// no rows found
endif; ?>
src: https://support.advancedcustomfields.com/forums/topic/gallery-field-inside-a-repeater-field/
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.