Support

Account

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/