Support

Account

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