Home › Forums › General Issues › Photoswipe lightbox does't detect image field (solved) › Reply To: Photoswipe lightbox does't detect image field (solved)
Hi, I know this is older thread, but I ran into same problem and fixed it in a similar way @jeremynative did.
Addind a tag with class “fancybox-img” and actual url of full size img as href worked for me.
I was basically doing image swiper and in a loop when I was generating images I just added a tag mentioned above.
Here is my code (notice the a tag i added on img):
<div class="swiper-container gallery-swiper">
<div class="swiper-wrapper">
<?php
$gallery = get_field("galerie");
if ($gallery)
foreach ( $gallery as $img ){
?>
<div class="swiper-slide">
<a class="fancybox-img" href="<?php echo esc_url($img['url']);?>">
<img src="<?php echo esc_url($img['sizes']['homepage-nav']);?>" link=file alt="<?php esc_attr($img['alt']);?>"/>
</a>
</div>
<?php
}
?>
</div>
<div class="swiper-button-next"></div>
<div class="swiper-button-prev"></div>
</div>
Hope tihs will be helpfull to someone.
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!
🤔 Curious about the ACF user experience? So are we! Help guide the evolution of ACF by taking part in our first ever Annual Survey and guarantee you’re represented in the results. https://t.co/0cgr9ZFOJ5
— Advanced Custom Fields (@wp_acf) May 8, 2023
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.