Support

Account

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[0]; ?>" alt="<?php echo $row['alt']; ?>">
                            </div>
                    <?php endforeach; ?>
                        </div>
                    <?php endif;
    
                endif; 
    
            endwhile;
    
        else :
    
        endif; ?>