Support

Account

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

Unread

ACF Gallery Caption in Responsive Lightbox

  • Hi,

    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']; ?>"/>
    						</a>
    					</dt>
    					
    					<?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; ?>
    				
    				</dl>
    				
    			<?php endforeach; ?>
    		</div>
    	</div>
    <?php endif; ?>
Viewing 1 post (of 1 total)

The topic ‘ACF Gallery Caption in Responsive Lightbox’ is closed to new replies.