I need help figuring out what is wrong with my code.
I am trying to show a Flexible Content area with 5 Layouts.
Each Layout needs to have:
– Background Image
– Text overlay
This is for a Service Blup type area.
Here is my code and which is not working properly.
// loop through the rows of data
while ( have_rows(‘service_areas’) ) : the_row();
if( get_row_layout() == ‘service_area_1’ ):
$image = get_sub_field(‘bg_image’);
echo ‘
‘;
$text = the_sub_field(‘text’);
elseif( get_row_layout() == ‘service_area_2’ ):
$image = get_sub_field(‘bg_image’);
echo ‘
‘;
$text = the_sub_field(‘text’);
elseif( get_row_layout() == ‘service_area_3’ ):
$image = get_sub_field(‘bg_image’);
echo ‘
‘;
$text = the_sub_field(‘text’);
elseif( get_row_layout() == ‘service_area_4’ ):
$image = get_sub_field(‘bg_image’);
echo ‘
‘;
$text = the_sub_field(‘text’);
elseif( get_row_layout() == ‘service_area_5’ ):
$image = get_sub_field(‘bg_image’);
echo ‘
‘;
$text = the_sub_field(‘text’);
endif;
endwhile;