<?php
// check if the flexible content field has rows of data
if( have_rows(‘layouts’) ):
// loop through the rows of data
while ( have_rows(‘layouts’) ) : the_row();
if( get_row_layout() == ‘two_columns’ ): ?>
<div class=“row two-columns“>
<div class=“col col-6″>
<?php the_sub_field(‘first_column’); ?>
</div>
<div class=“col col-6″>
<?php the_sub_field(‘second_column’); ?>
</div>
</div>
<?php elseif( get_row_layout() == ‘wrap-img-left’ ): ?>
<div class=“wrap-img“>
<img class=“w50 alignleft“ src=“<?php the_sub_field(‘img’); ?>“ alt=““>
<?php strip_tags(the_sub_field(‘text’)); ?>
</div>
<?php elseif( get_row_layout() == ‘wrap-img-right’ ): ?>
<div class=“wrap-img“>
<img class=“w50 alignright“ src=“<?php the_sub_field(‘img’); ?>“ alt=““>
<?php strip_tags(the_sub_field(‘text’)); ?>
</div>
<?php elseif( get_row_layout() == ‘text’ ): ?>
<?php the_sub_field(‘text’); ?>
<?php endif;
endwhile;
else :
// no layouts found
endif;
?>

<?php
// check if the flexible content field has rows of data
if( have_rows(‘layouts’) ):
// loop through the rows of data
while ( have_rows(‘layouts’) ) : the_row();
if( get_row_layout() == ‘two_columns’ ): ?>
<div class=“row two-columns“>
<div class=“col col-6″>
<?php the_sub_field(‘first_column’); ?>
</div>
<div class=“col col-6″>
<?php the_sub_field(‘second_column’); ?>
</div>
</div>
<?php elseif( get_row_layout() == ‘wrap-img-left’ ): ?>
<div class=“wrap-img“>
<img class=“w50 alignleft“ src=“<?php the_sub_field(‘img’); ?>“ alt=““>
<?php strip_tags(the_sub_field(‘text’)); ?>
</div>
<?php elseif( get_row_layout() == ‘wrap-img-right’ ): ?>
<div class=“wrap-img“>
<img class=“w50 alignright“ src=“<?php the_sub_field(‘img’); ?>“ alt=““>
<?php strip_tags(the_sub_field(‘text’)); ?>
</div>
<?php elseif( get_row_layout() == ‘text’ ): ?>
<?php the_sub_field(‘text’); ?>
<?php endif;
endwhile;
else :
// no layouts found
endif;
?>