Support

Account

Home Forums Add-ons Flexible Content Field Multiple Repeater fields inside of a flexible content field

Solved

Multiple Repeater fields inside of a flexible content field

  • Hi There,

    I’m using a relationship field inside a flexible content field. I’ve tried to use both options with and without setup_postdata and my last layout loop (service-list) will not work after the relationship field. Everything above works fine.

    <?php
     
    // check if the flexible content field has rows of data
    if( have_rows('page-copy') ):
     
         // loop through the rows of data
        while ( have_rows('page-copy') ) : the_row();
    	
    	
     
            if( get_row_layout() == 'content-block' ):?>
    		
    		<section class="<?php the_sub_field('layout_class'); ?>">
      <div class="container">
        <div class="row">
        
    
     <?php
            	the_sub_field('left-side-content');
    			the_sub_field('right-side-content');
     
     
     ?>
     </div>
       </div>
    </section>
    
    <?php
            elseif( get_row_layout() == 'photo-right-cta' ): 
     
            	$file = get_sub_field('file');
    			
    			 elseif( get_row_layout() == 'testimonials-list' ): 
    
    				$posts =  get_sub_field('testimonials');
    				 
    				if( $posts ): ?>
    					 <section class="quotes">
      <div class="container"> <a id="what-clients-say" class="visible-xs extra-wide centered red clients button"><i></i>What our clients are saying<span class="arrow-down"></span></a>
        <ul class="row" id="quote-container">
    					<?php foreach( $posts as $p): ?>
    						
                            
                             <li class="col-lg-6 client"> 
                             <img src="<?php the_field('testimonial_image', $p->ID); ?>">
                             <?php the_field('testimonial_copy', $p->ID); ?>
    
                             <p class="client-name"><?php the_field('testimonial_name', $p->ID); ?> <strong><?php echo get_the_title( $p->ID ); ?></strong>
    
    						
    							
    						
    				
    					<?php endforeach; ?>
                        		</ul>
                        	</div>
                        </section>
    					
                        
                        
                   <?php  elseif( get_row_layout() == 'service-list' ): ?>
                   
                        <div style="border:1px solid red; width:500px; height:500px;">Service List here</div>
                        
    				<?php endif; ?>
    							
                
                
                
                
                
     
            <?php endif;
     
        endwhile;
     
    else :
     
        // no layouts found
     
    endif;
     
    ?>
  • Nevermind. I had an endif; at the wrong location

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

You must be logged in to reply to this topic.