Support

Account

Home Forums Add-ons Repeater Field Get galleries in repeater from Gutenberg Block Reply To: Get galleries in repeater from Gutenberg Block

  • Check that the “project_galleries” field in ACF is set up as a REPEATER, and inside it, “project_gallery” is configured as a gallery.

    To work with Gutenberg blocks, you can try using the “get_field()” function instead of “have_rows()”. Try this:

    <?php 
    $galleries = get_field('project_galleries');
    if($galleries): 
        foreach($galleries as $gallery):
            $images = $gallery['project_gallery'];
            if($images):
                foreach($images as $image): ?>
                    <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>
                <?php endforeach;
            endif;
        endforeach;
    endif; ?>