Support

Account

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;
    
        ?>