Support

Account

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:

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