Support

Account

Home Forums Add-ons Flexible Content Field Repeater Field inside Flexible Content

Helping

Repeater Field inside Flexible Content

  • Hi guys

    I want to use repeater inside Flexible Content, can someone tell me if it is possible if yes, please tell me how, or send me docs where i can see it.

    My Code:
    http://jsfiddle.net/e455pbmw/1/
    http://i.imgur.com/9lY1Moa.png

  • sure you can have repeater inside flexible field.
    from original docs here

    Nested Loop

    <?php
    
    // check if the flexible content field has rows of data
    if( have_rows('flexible_content_field_name') ):
    
     	// loop through the rows of data
        while ( have_rows('flexible_content_field_name') ) : the_row();
    
    		// check current row layout
            if( get_row_layout() == 'gallery' ):
    
            	// check if the nested repeater field has rows of data
            	if( have_rows('images') ):
    
    			 	echo '<ul>';
    
    			 	// loop through the rows of data
    			    while ( have_rows('images') ) : the_row();
    
    					$image = get_sub_field('image');
    
    					echo '<li><img src="' . $image['url'] . '" alt="' . $image['alt'] . '" /></li>';
    
    				endwhile;
    
    				echo '</ul>';
    
    			endif;
    
            endif;
    
        endwhile;
    
    else :
    
        // no layouts found
    
    endif;
    
    ?>

    basically it is nothing very special. it is just a (repeater) loop inside a (flexible content) loop

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Repeater Field inside Flexible Content’ is closed to new replies.