Support » Plugin: Responsive Lightbox & Gallery » Create Lightbox for ACF Image

  • I love this plugin, and it worked awesome on my WP galleries.

    I have some pages where I’m pulling specific images in via an ACF field. I’ve tried to get the lightbox affect to apply, but can’t make it work.

    I’m in a custom theme built on Roots, so no theme mess to deal with. Is it possible to have an ACF image when clicked light box with this plugin?


Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author dFactory


    Ok, that’s an example for gallery:

    $images = get_field( 'gallery' );
    if( $images ): ?>
    	<?php foreach( $images as $image ): ?>
    	<?php $image_large = wp_get_attachment_image_src($image['id'], 'large'); ?>
            <?php $image_thb = wp_get_attachment_image_src($image['id'], 'thumbnail'); ?>
            <a href="<?php echo $image_large[0]; ?>" rel="lightbox[gallery]">
                <img src="<?php echo $image_thb[0]; ?>" class="attachment-thumbnail" />
    	<?php endforeach; ?>
    <?php endif; ?>
    Thread Starter theatereleven


    Thanks, but I’m not doing galleries.

    I have an Advanced Custom Field that is set to image, and i’m inserting it into my page template like this:

    <img src=”<?php the_field(‘bio_pic_one’); ?>”>

    And I’d like to somehow add a light box to that. Is it possible with this plugin?

    Plugin Author dFactory


    That is just an image, it doesn’t link to anything so can’t have lightbox applied. If you make one image (e.g. thumbnail) link to a second image (e.g. large) and you add a rel=”lightbox” attribute to that link the lightbox effect will be applied (and generally possible).

    This code works great for a gallery field.
    I tried to modify it to use it inside a repeater field. Several tries, no success.
    Could someone show me how?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Create Lightbox for ACF Image’ is closed to new replies.