Title: Advanced Custom Fields image field
Last modified: August 22, 2016

---

# Advanced Custom Fields image field

 *  Resolved [dadra](https://wordpress.org/support/users/dadra/)
 * (@dadra)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/advanced-custom-fields-image-field/)
 * Thanks for your great work on this plugin.
 * I’m using Advanced Custom Fields and am stumped on how to integrate Simple Lightbox
   into image fields. For regular WYSIWYG fields I’m using this…
 *     ```
       <?php
       $content = get_field('wysiwyg');
       if ( function_exists('slb_activate') )
       $content = slb_activate($content);
       echo $content;
       ?>
       ```
   
 * …which works great, but adapting that to image fields is eluding me. Here’s my
   template code:
 *     ```
       <?php
       $image = get_field( 'img' );
   
       if( ! empty( $image ) ) {
       $url    = $image['url'];
       $alt    = $image['alt'];
       $caption = $image['caption'];
       $size   = 'large';
       $thumb    = $image['sizes'][ $size ];
       $width  = $image['sizes'][ $size . '-width' ];
       ?>
   
       <?php if( $caption ): ?>
   
       <div class="wp-caption" style="width: <?php echo $width; ?>px">
   
       <?php endif; ?>
   
       <a href="<?php echo $url; ?>">
   
       <img src="<?php echo $thumb; ?>" alt="<?php echo $alt; ?>" />
   
       </a>
   
       <?php if( $caption ): ?>
   
       <p class="wp-caption-text"><?php echo $caption; ?></p>
   
       </div>
   
       <?php endif; ?>
   
       <?php } ?>
       ```
   
 * Can we integrate Simple Lightbox into this? Thanks in advance!
 * [https://wordpress.org/plugins/simple-lightbox/](https://wordpress.org/plugins/simple-lightbox/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [dadra](https://wordpress.org/support/users/dadra/)
 * (@dadra)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/advanced-custom-fields-image-field/#post-5298052)
 * Here’s the answer:
 * [http://stackoverflow.com/questions/26064557/wp-acf-image-fields-simple-lightbox-plugin-integration](http://stackoverflow.com/questions/26064557/wp-acf-image-fields-simple-lightbox-plugin-integration)
 *  Plugin Author [Archetyped](https://wordpress.org/support/users/archetyped/)
 * (@archetyped)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/advanced-custom-fields-image-field/#post-5298053)
 * Hi, apologies for the delayed response, for some reason, I didn’t receive an 
   email notification for your post.
 * Using output buffering to store the HTML output in a variable and then activating
   it using `slb_activate()` as suggested at that link is a good option. I’m glad
   you were able to find a solution.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Advanced Custom Fields image field’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/simple-lightbox.svg)
 * [Simple Lightbox](https://wordpress.org/plugins/simple-lightbox/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-lightbox/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-lightbox/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-lightbox/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-lightbox/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-lightbox/reviews/)

## Tags

 * [image field](https://wordpress.org/support/topic-tag/image-field/)

 * 2 replies
 * 2 participants
 * Last reply from: [Archetyped](https://wordpress.org/support/users/archetyped/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/advanced-custom-fields-image-field/#post-5298053)
 * Status: resolved