Support

Account

Home Forums Add-ons Gallery Field Getting ACF gallery images' captions

Unread

Getting ACF gallery images' captions

  • Hi

    I am trying to get the captions of a gallery, but as I am new to coding I am not sure what I have to do.

    In case, I have a slide show that is working ( it changes the images) but the captions don’t appear.

    Here is the code:

    <!-- left col -->
                    <div class="project-col-left">
                            <div class="project-return"> <a onclick="history.go(-1)">< Return</a></div>
                            <div class="project-title"> <?php the_title();?></div>
                            <div class="project-captions" id="target"><?php echo esc_html($image['caption']); ?></div>
                            <div class="project-index"><a href="/gallery-index/">Index</a></div>
                    </div>
                    
    </div>
    
    <!-- right col --> 
    
    <?php 
    $images = get_field('gallery');
    if( $images ): ?>
    
    <div class="project-col-right">
             <?php foreach( $images as $image ): ?>
            <div id="index" class="mySlides tabcontent">
             <img src="<?php echo ($image['sizes']['grande']); ?>" class="project-img">
             
            </div>
    
            <?php endforeach; ?>
    </div>
    <?php endif; ?>
    
    <!-- prev and next -->
            <div class="prev" onclick="plusDivs(-1)"> </div>
            <div class="next" onclick="plusDivs(1)"> </div>
    

    Thanks a lot for your support

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.