Home Forums Add-ons Repeater Field ACF repeater field only show one row


ACF repeater field only show one row

  • Hello Guys

    I’ve got a problem with some code below. I query some posts and in this posts their is a repeater field, but it seems that it shows only the first row of the repeater field ‘evenement’. The field that i want to show is a post object !

    I don’t know if it’s very clear ?

    Somebody can help me ?


    <?php $query = new WP_Query(
    'category__not_in' => array(520),
    'category__and' => array(2905,1582),
    'post_status' => array( 'draft'),
    'post_type' => 'spectacles',
    'lang' => 'fr',
    'showposts' => -1,
    'meta_key' => 'date_debut',
    'orderby' => 'meta_value_num',
    'order' => 'ASC')
    <?php if($query->have_posts()) : while ($query->have_posts() ) : $query->the_post();?>
    <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
        <div id="bloc-picto">
            <div class="item-picto">
                <img src="<?php $picto = get_field('picto');if( !empty($picto) ): ?><?php echo $picto['url']; ?><?php else: ?><?php $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id,'icon', true); echo $image_url[0];  ?><?php endif; ?>" width="40px" height="40px">
            <div class="legend-picto">
            <b><?php the_title(); ?></b>
                <?php if( get_field('compagnie') ): ?>
                <?php the_field('compagnie'); ?>
                <?php endif; ?>
                <?php if( get_field('acces_star') ): ?>
                <div style="font-size:10px"><?php the_field('acces_star'); ?></div>
                <?php endif; ?>
                <?php if( have_rows('evenement') ): while ( have_rows('evenement') ) : the_row(); ?>
                <?php $post_object = get_sub_field('lieu_evenement');if( $post_object ):
                $post = $post_object; setup_postdata( $post ); ?>
                    <i><?php the_title(); ?></i>
                <?php wp_reset_postdata();  ?>
                <?php endif; ?>
                <?php endwhile; ?>
                <?php endif; ?>
    <?php wp_reset_postdata(); ?>
    <?php endwhile; else: ?>
    <?php endif; ?>
  • The problem you’re having has to do with nested queries. Sorry to do this to you, but most of the results in this search have replies from me about this issue and various ways for correcting.

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

The topic ‘ACF repeater field only show one row’ is closed to new replies.