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;
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.