Home › Forums › Add-ons › Repeater Field › Problema withe repeater item › Reply To: Problema withe repeater item
Hello.
I working on a similar problem for some hours now, I just can’t find the solution.
I tried the code above, only the first repeater element is displayed, followed by weird posts, I dont even know where they came from.
Here’s my code :
// main query
<?php $args = array (‘post_type’ => ‘newslettre’, ‘order’ => ‘DESC’,’posts_per_page’ => ‘1’, );
$my_query= new WP_Query( $args );
while ( $my_query->have_posts() ) : $my_query->the_post();
// repeater
if( have_rows(‘articles’) ):
while ( have_rows(‘articles’) ) : the_row();
$post_object = get_sub_field(‘choisir_un_article’);
if( $post_object ):
$temp_post = $post;
foreach( $post_object as $post):
setup_postdata($post);
?>
// … do some stuff
<?php endforeach;
$post = $temp_post; ?>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
Your hekl would be very appreciated !!!
Thank you
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.