Support

Account

Home Forums Add-ons Flexible Content Field Flexible content outputs weird HTML Reply To: Flexible content outputs weird HTML

  • just to get sure:
    you have a flexible field with which layouts?
    if headline and text_content are separate layouts than it is clear why it do it like that. (because it do for each layout echo headline and text, and at each one there is missing the other field)

    if( have_rows('content') ):
    while( have_rows('content') ): the_row();
    if( get_row_layout() == 'layoutname_of_headline' ){ 
    $the_headline = get_sub_field('headline');
    echo '<h1>'.$the_headline.'</h1>';
    }
    if( get_row_layout() == 'layoutname_of_text_content' ){ 
    $the_text_content = get_sub_field('text_content');
    echo '<p>'.$the_text_content.'</p>';
    }
    endwhile; endif;