Support

Account

Home Forums Add-ons Flexible Content Field Flexible content wrong order Reply To: Flexible content wrong order

  • It looks like this:

    <div>
        <?php if( have_rows('post_content') ): ?>
            <?php while ( have_rows('post_content') ) : the_row();
                if( get_row_layout() == 'layout_text' ): ?>
                <?php the_sub_field('text'); ?>
            <?php endif; endwhile; ?>
        <?php endif; ?>
    </div>
    
    <div>
        <?php if( have_rows('post_content') ): ?>
            <?php while ( have_rows('post_content') ) : the_row();
                if( get_row_layout() == 'layout_image' ): ?>
                <?php the_sub_field('image'); ?>
            <?php endif; endwhile; ?>
        <?php endif; ?>
    </div>
    
    <div>
        <?php if( have_rows('post_content') ): ?>
            <?php while ( have_rows('post_content') ) : the_row();
                if( get_row_layout() == 'layout_video' ): ?>
                <div class="videowrapper">
                    <?php the_sub_field('video'); ?>
                </div>
            <?php endif; endwhile; ?>
        <?php endif; ?>
    </div>

    Maybe I should somehow make it in to one loop, but I can’t figure it out.

    Thanks