Displaying the gallery with links
-
Hi, thanks for the great plugin.
Using the code from the post “Instructions for use on frontend?” I’ve made my image display from my gallery work. What I can’t figure out is how to get the thumbnails to be linked to the full sized images so I can display them in a lightbox. Here is what I have so far. This works to display the image thumbnails, and the images have a link, but it always defaults to the current post url and not the image url.
I know I’m missing something in the $url declaration but not sure what.
Thanks for any help you can provide. 🙂$images = get_field('post_gallery');
foreach($images as $gallery){
$url = $gallery['metadata']['file_url'];
?>
<div style="display:inline-block;">
<!-- <img src="<?php echo $gallery['metadata']['thumbnail']['file_url']; ?>" alt="Gallery Image"/> -->
<a href="<?php echo $url; ?>">'<img src="<?php echo $gallery['metadata']['thumbnail']['file_url']; ?>">'</a>
</div>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.