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 4, 2016 at 10:39 pm #6319

Hi Eric, the message “The requested content cannot be loaded” indicates that either there is no media content found on the linked location or the media type is other than expected.

I suspect it is caused by that empty <a class="fancybox"> anchor in your code. It must have a href attribute for FancyBox to work with.

Also, to prevent the first image to be shown twice (it’s linked from the thumbnail and within the gallery) I would suggest to use array_shift to both retrieve and remove the first image id from the gallery.

Both changes would result in code like:

<div class="service-gallery-column">
$image_ids = get_sub_field( 'gallery_images', false, false );
$featured = array_shift( $image_ids );
$shortcode = '';
	<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'); ?>
	<div class="fancybox-hidden">
		<?php echo do_shortcode( $shortcode ); ?>

(caveat: code is untested and might have errors!)