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

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.

<?php 

$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>
            </li>
        <?php endforeach; ?>
    </ul>
<?php endif; ?>

 

Signup For Emails

Want to be notified when new tutorials are released? Signup below for our roundup emails. We promise not to spam and won't blow up your inbox. 
  • This field is for validation purposes and should be left unchanged.
Jonathan Jernigan, Founder
Permaslug and APEX Web Solutions

Join Permaslug

Membership Benefits Include:

  • Ultimate Oxygen Course
  • Ultimate Woocommerce Course
  • ACF Pro Course
  • Material Design Lite
  • Template Downloads
  • Community
  • And more!
register

More Posts

Setting up SearchWP Live Ajax Search in Oxygen

I've been wondering how a search driven site would work on WordPress. Will users still want to use main navigation? Will they want to use search right off the bat? I'm hoping to start answering…
READ post

Social Feeds and Reviews with WP Social Ninja for WordPress

Social media feeds in WordPress have always been a sticking point because most plugins were unreliable and difficult to use, or their free version was not really usable. The team behind Fluent Forms brings us…
READ post

Perfmatters Improved My Google Page Speed by 145%

I'm a bit embarrassed to say this, but my page speed scores on my own agency website and the mobile version of the Permaslug site sucked until just 24 hours ago. (If you don't want…
READ post
menu linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram