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


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.

    // 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">
            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; ?>
                   <?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;
    else :
        // no layouts found
  • Nevermind. I had an endif; at the wrong location

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

The topic ‘Multiple Repeater fields inside of a flexible content field’ is closed to new replies.