Home › Forums › Add-ons › Gallery Field › ACF Gallery Caption in Responsive Lightbox
Tagged: acf gallery, caption, lightbox fancybox
I am trying to mimic WP Gallery’s feature, which allows to use Caption field in Responsive Lightbox.
I have created such code, which is similar to WP Gallery’s one. Yet caption field is not being shown in lightbox mode. And it works fine for WP Gallery.
Anyone got idea what to do ?
<?php if( $gallery ): ?>
<div class="row no-gutters">
<?php foreach( $gallery as $picture ): ?>
<a rel="lightbox" href="<?php echo $pic['sizes']['lightbox']; ?>">
<img src="<?php echo $pic['sizes']['thumbnail']; ?>" alt="<?php echo $pic['alt']; ?>" aria-describedby="gallery-1-<?php echo $pic['id']; ?>"/>
<?php if($pic['caption']): ?>
<dd id="gallery-1-<?php echo $pic['id']; ?>" class="wp-caption-text gallery-caption"><?php echo $pic['caption']; ?></dd>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Open a new forum thread
Helping others is a great way to earn karma, gain badges and help ACF development!
New Post! ⚡️ ACF Theme Code Review. Work Smarter, not Harder. https://t.co/eRl1FQdCBo @hookturn_io— Advanced Custom Fields (@wp_acf) March 26, 2018
New Post! ⚡️ ACF Theme Code Review. Work Smarter, not Harder. https://t.co/eRl1FQdCBo @hookturn_io
© 2018 Advanced Custom Fields. Terms & Conditions. Subscribe