Home › Forums › Add-ons › 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.
<?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;
?>
The topic ‘Multiple Repeater fields inside of a flexible content field’ is closed to new replies.
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.