How to Add a Gallery in an ACF Repeater – Oxygen Builder

Written By

Jonathan Jernigan

Out of the box, the Oxygen Gallery element cannot show images from a gallery field in an Advanced Custom Fields repeater. You need to use a code block in your loop (or in your Oxygen Builder Repeater element if you’re using that).

You’ll also need a lightbox solution. Again, either a custom code solution or some 3rd party Oxygen addons let you define a custom gallery/lightbox source.

The custom code for use in your ACF Repeater to view your gallery images you can find below. Make sure to change ‘gallery’ to your gallery field name.


$images = get_sub_field('gallery');

if( $images ): ?>
    <ul class="thumb-gallery">
        <?php foreach( $images as $image ): ?>
            <li class="thumb-gallery-li">
                     <img src="<?php echo $image['sizes']['thumbnail']; ?>" data-large="<?php echo $image['sizes']['large']; ?>" alt="<?php echo $image['alt']; ?>" />
                <p><?php echo $image['caption']; ?></p>
        <?php endforeach; ?>
<?php endif; ?>


Signup for the most inconsistent newsletter this side of the Mississippi

Delivered on a regular-as-I-can basis, I'll share with you the tl;dr of new blog posts and videos, exciting announcements, and other valuable information from around the WordPress ecosphere. You'll never get more than one email per week from me.

"*" indicates required fields

This field is for validation purposes and should be left unchanged.