Home › Forums › Add-ons › Flexible Content Field › Need help for correct markup for nested flexible content field › Reply To: Need help for correct markup for nested flexible content field
Made a comment in your code, hope it helps
<?php
// check if the flexible content field has rows of data
if( have_rows('reihe') ):
// loop through the rows of data
while ( have_rows('reihe') ) : the_row();
// check current row layout
if( get_row_layout() == 'reihe' ):
// check if the nested repeater field has rows of data
// shoiuldn't this if have rows one 'belinke_spalte'
if( have_rows('reihe') ):
// loop through the rows of data
while ( have_rows('linke_spalte') ) : the_row();
the_sub_field('linke_spalte_text');
$image = get_sub_field('linke_spalte_bild');
echo '<img src="' . $image['url'] . '" alt="' . $image['alt'] . '" />';
endwhile;
// Rechte Spalte
elseif( have_rows('rechte_spalte') ):
// loop through the rows of data
while ( have_rows('rechte_spalte') ) : the_row();
the_sub_field('rechte_spalte_text');
$image = get_sub_field('rechte_spalte_bild');
echo '<img src="' . $image['url'] . '" alt="' . $image['alt'] . '" />';
endwhile;
//.Rechte Spalte
endif;
endif;
endwhile;
else :
// no layouts found
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.