Im still having this exact problem even with this “solution”
<?php
$gallery = get_sub_field('gallery', 'option');
foreach($gallery as $photo):?>
<a href="<?php echo $photo['url']; ?>" class="cbox item">
<img src="<?php echo $photo['sizes']['thumbnail']; ?>"/>
</a>
<?php endforeach;?>
The name of the field is gallery.
additionally I tried to pass in the post id into the second param :
<?php
$postid = get_the_ID();
$gallery = get_sub_field('gallery', $postid);
foreach($gallery as $photos): ?>
<a href="<?php echo $photos['url']; ?>" class="cbox item">
<img src="<?php echo $photos['sizes']['thumbnail']; ?>"/>
</a>
<?php endforeach;?>
Any thoughts sir ?
when I var dump the $gallery obj it returns bool
php errors are the same “Invalid value in foreach”
UPDATE:
I just reverted our ACF plugins back to 4.2.2 and it works now.