<?php
// check if the flexible content field has rows of data
if( have_rows('flexi') ):
// loop through the rows of data
while ( have_rows('flexi') ) : the_row();
// check current row layout
if( get_row_layout() == 'flex_test' ):
// repeater loop
if( have_rows('content') ):
// loop through the rows of data
echo '<div class="row">';
while ( have_rows('content') ) : the_row();
$col = get_sub_field('col');
echo '<div class="col-md-' . $col . '">';
$image = get_sub_field('image');
echo '<img src="' . $image['url'] . '" style="width:100%" alt="' . $image['alt'] . '" />';
$text = get_sub_field('text');
echo '<p>' . $text . '</p>';
echo '</div>';
endwhile;
echo '</div>';
endif;
// single echo 2 col
echo '<div class="row"><div class="col-md-12">';
the_sub_field('paragraph');
echo '</div></div>';
elseif( get_row_layout() == 'multicol' ):
// single echo 2 col
if( get_sub_field('columns') == '1' ):
echo '<div class="col-md-12">';
the_sub_field('paragraph');
echo '</div>';
elseif( get_sub_field('columns') == '2' ):
echo '<div class="col-md-6">';
the_sub_field('paragraph');
echo '</div>';
echo '<div class="col-md-6">';
the_sub_field('paragraph_2');
echo '</div>';
endif;
endif;
endwhile;
else :
// no layouts found
endif;
?>