Home Forums Add-ons Gallery Field ACF Gallery Caption in Responsive Lightbox


ACF Gallery Caption in Responsive Lightbox

    • mastafu

    • November 14, 2017 at 5:58 am


    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="gallery">
    		<div class="row no-gutters">
    			<?php foreach( $gallery as $picture ): ?>
    				<dl class="gallery-item">
    					<dt class="gallery-icon">
    						<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; ?>
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

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.