Reply To: Easy fancybox open wordpress gallery

Your Account / Forums / Easy FancyBox Pro / Easy fancybox open wordpress gallery / Reply To: Easy fancybox open wordpress gallery

April 5, 2016 at 7:57 pm #6327

OK, here is a quick sample conversion from my earlier snippet. It needs to be tested of course and then adapted to fit your case. The general idea is to remove the do_shortcode and replace it with a foreach that creates empty anchor tags (invisible links) to the gallery images. There is no need for the fancybox-hidden div anymore since these links are not visible for human eyes.


<div class="gallery">
<?php
$images = get_sub_field( 'gallery_images', false, false );
$featured = array_shift( $image_ids );
?>
	<a href="<?php echo wp_get_attachment_url( $featured ); ?>" title="<?php the_sub_field('gallery_title'); ?>">
		<?php echo wp_get_attachment_image( $featured, 'blog-thumb'); ?>
	</a>
<?php foreach ( $images as $image ) { ?>
	<a href="<?php echo wp_get_attachment_url( $image ); ?>" title="<?php the_sub_field('gallery_title'); ?>"></a>
<?php } ?>
</div>

You’ll need to put the div.gallery back in the Sections field in this case which will now work for both regular WordPress galleries and your custom generated light box galleries.

Hope that helps 🙂