Home › Forums › Add-ons › Gallery Field › 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">
<?php
$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']);
};
?>
<ul>
<?php add_thickbox();
foreach( $images as $image ): ?>
<li>
<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']; ?>" />
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
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):
<?php
$image_ids = get_field('additional_product_images', false, false);
$shortcode = '[gallery ids="' . implode(',', $image_ids) . '" link="file" columns="2"]';
echo do_shortcode( $shortcode );
?>

I’m afraid this is more WordPress Thickbox related question. I found this thread that is similar to your question: https://wordpress.org/support/topic/plugin-nextgen-gallery-thickbox-click-image-for-next-rather-than-close. If you need further assistance, please ask it in WordPress forum. I’m sorry for the inconvenience.
Thanks!
The topic ‘Gallery w/Thickbox, no prev/next?’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.