Home Forums Add-ons Gallery Field Gallery w/Thickbox, no prev/next?


Gallery w/Thickbox, no prev/next?

  • Hi there,
    I’m trying to use the built-in WordPress Thickbox function to create a gallery for my products. I’ve used the ACF Gallery feature nicely. I’ve got the images coming in, and I’m using the following code, which works to an extent. The problem is that I have to close each image in order to be able to click on the next. I would far prefer to be able to just click ‘next’ or ‘previous’. Related, I’d like to include the Featured Image of the post in the thickbox gallery, just not in the thumbnails gallery created with ACF.

    <div class="prod-gallery">
    		$images = get_field('additional_product_images');
    		$image_ids = get_field('additional_product_images', false, false);
    		$shortcode = '[gallery ids="' . implode(',', $image_ids) . '"]';
    		for ($i=0; $i<count($images); $i++) {
    			// the id of the image is in $images[$i]['ID']
    			$images[$i]['link_url'] = get_field('link_url', $images[$i]['id']);
    		<?php add_thickbox();
    		foreach( $images as $image ): ?>
    			<a href="<?php echo $image['url']; ?>" class="thickbox">
    				<img src="<?php echo $image['sizes']['dnf-prod-thumb']; ?>" class="prod-thumbs" alt="<?php echo $image['alt']; ?>" />
    		<?php endforeach; ?>

    I have alternately tried the following as well, but I can’t get thickbox to activate at all (I thought that was done with the “link=file” parameter in the shortcode):

    	$image_ids = get_field('additional_product_images', false, false);
    	$shortcode = '[gallery ids="' . implode(',', $image_ids) . '" link="file" columns="2"]';
    	echo do_shortcode( $shortcode );
  • Hi @brotsky_pixie

    I’m afraid this is more WordPress Thickbox related question. I found this thread that is similar to your question: If you need further assistance, please ask it in WordPress forum. I’m sorry for the inconvenience.


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

The topic ‘Gallery w/Thickbox, no prev/next?’ is closed to new replies.