When your website means business.

ACF, Gallery | Type: PHPACF Repeater Gallery (Image Array)

This example shows a full page width, with 4 gallery images across. This approach requires the ‘Image Array’ return value on the image field.

It’s possible to grab the ‘alt’ from the image array, but I’ve found people rarely complete that field when they upload images: thus the ‘gallery_imagetitle’ field. The ‘rel=”lightbox” ‘ bit triggers the modal window for the lightbox plugin.

<div class="medium-12 columns gallery">
    echo '<div class="row">';
    echo '<div class="image-container">';
        $galimg = get_sub_field('gallery_image');
        $galimgtitle = get_sub_field('gallery_imagetitle');
        if ($galimg) {
        $url = $galimg['url'];
        $size = 'thumbnail';
        $thumb = $galimg['sizes'][ $size ];
        echo '<div class="medium-3 columns galimg">';
        echo '<a href="'.$url.'" title="'.$galimgtitle.'" rel="lightbox">';
        echo '<img src="'.$thumb.'" alt="'.$galimgtitle.'" />';
        echo '</a>';
        echo '</div>';
    echo '</div>';
    echo '</div>';

We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Cookies Notice