Home › Forums › Front-end Issues › Can't display gallery images inside flexible content › Reply To: Can't display gallery images inside flexible content
I know this post is from a while ago now but I had a similar issue. I solved it like so:
<?php if (have_rows('flexible_content')) : while (have_rows('flexible_content')) : the_row(); if (get_row_layout() == 'images_row'): $header = get_sub_field('heading'); ?> <div class="block-text-centered"> <h2 class="upper grey"><?php echo $header;?></h2> </div> <?php $rows = get_sub_field('images'); if ($rows) : ?> <div class="pure-g"> <?php foreach ($rows as $row) : $img = wp_get_attachment_image_src($row['ID'], 'thumbnail'); ?> <div class="pure-u-1-5 client-logo"> <img src="<?php echo $img; ?>" alt="<?php echo $row['alt']; ?>"> </div> <?php endforeach; ?> </div> <?php endif; endif; endwhile; else : endif; ?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
2022 was a big year for Advanced Custom Fields, with more capabilities, a new generation of ACF Blocks, a refreshed UI, and a new home. Our year in review post looks at advancements we’ve made and offers a glimpse of the future.— Advanced Custom Fields (@wp_acf) January 6, 2023
© 2023 Advanced Custom Fields.