Home Forums Add-ons Gallery Field get_field('galery') return false Reply To: get_field('galery') return false

  • what code do you use to display the gallery? and what is your gallery-fieldname?
    gallery is an array, that means you need a foreach loop like this to show the images inside that array:

    $images = get_field('gallery');
    if( $images ): ?>
            <?php foreach( $images as $image ): ?>
                    <a href="<?php echo $image['url']; ?>">
                         <img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" />
                    <p><?php echo $image['caption']; ?></p>
            <?php endforeach; ?>
    <?php endif; ?>