Support

Account

Home Forums General Issues Getting Flexible Content to Display Uploaded Image as Background with Text

Unread

Getting Flexible Content to Display Uploaded Image as Background with Text

  • 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 ‘

  • ' . $image['alt'] . '
  • ‘;

    $text = the_sub_field(‘text’);

    elseif( get_row_layout() == ‘service_area_2’ ):
    $image = get_sub_field(‘bg_image’);

    echo ‘

  • ' . $image['alt'] . '
  • ‘;

    $text = the_sub_field(‘text’);

    elseif( get_row_layout() == ‘service_area_3’ ):

    $image = get_sub_field(‘bg_image’);

    echo ‘

  • ' . $image['alt'] . '
  • ‘;

    $text = the_sub_field(‘text’);

    elseif( get_row_layout() == ‘service_area_4’ ):

    $image = get_sub_field(‘bg_image’);

    echo ‘

  • ' . $image['alt'] . '
  • ‘;

    $text = the_sub_field(‘text’);

    elseif( get_row_layout() == ‘service_area_5’ ):

    $image = get_sub_field(‘bg_image’);

    echo ‘

  • ' . $image['alt'] . '
  • ‘;

    $text = the_sub_field(‘text’);
    endif;

    endwhile;

Viewing 1 post (of 1 total)

The topic ‘Getting Flexible Content to Display Uploaded Image as Background with Text’ is closed to new replies.