Support

Account

Home Forums ACF PRO Multiple Repeater fields on single page wont work

Solving

Multiple Repeater fields on single page wont work

  • HI,

    I have 2 repeater fields on my home page – Left list / right list. Only the first one will display? If I remove the first repeater code block, the second list then shows fine.

    Is there a problem with displaying 2 or more repeater fields on a single page???

    Thanks!

  • I’ve never had a problem with multiple repeaters on one page. Maybe if you post the code you’re using for these two repeaters, can’t really say more without seeing it.

  • I’m having a similar issue but not sure whether it’s the same.

    2 Repeaters on an options page, both seem to work fine to start with, then show empty after saving values and clicking the Add Row button doesn’t do anything – is that the behaviour you’re seeing?

  • Like I said, I’m not seeing this issue. If someone can supply some code to look at maybe someone can work out why you are.

  • I dont have this issue anymore. Not sure what was happening but I dropped out, ran gulp && gulp watch again and things sorted themselves out.

  • I’m having a similar issue. Both repeater fields work on their own but when I try to have them both work at the same time only the first one works. Here is my code.

    <div class="top__wrap">
      <?php if ( have_rows( 'top_item' ) ):
        while( have_rows('top_item') ): the_row();
        $value = get_sub_field( 'value' );
        ?>
        <div class="top__item"><?php echo $value ?></div>
      <?php endwhile; endif;?>
    </div>
    
    <div class="bottom__wrap">
      <?php if ( have_rows( 'bottom_item' ) ):
        $symbol = get_sub_field( 'symbol' );
        ?>
        <div class="bottom__wrapper">
         <div class="bottom__item"><?php echo $symbol ?></div>
        </div>
      <?php endwhile; endif; ?>
    </div>
  • Try using reset_rows(); after endwhile;

  • Okay so i stumbled upon this solution by accident but it works for me so maybe it works for you as well.

    I use the code of @jorgecastellonjr for my explanation.
    This is his original code:

    <div class="top__wrap">
      <?php if ( have_rows( 'top_item' ) ):
        while( have_rows('top_item') ): the_row();
        $value = get_sub_field( 'value' );
        ?>
        <div class="top__item"><?php echo $value ?></div>
      <?php endwhile; endif;?>
    </div>
    
    <div class="bottom__wrap">
      <?php if ( have_rows( 'bottom_item' ) ):
        $symbol = get_sub_field( 'symbol' );
        ?>
        <div class="bottom__wrapper">
         <div class="bottom__item"><?php echo $symbol ?></div>
        </div>
      <?php endwhile; endif; ?>
    </div>

    The only thing you have to do is to add the following code before your if-statement for the second repeater:
    <?php have_rows( 'bottom_item' ) ): ?>

    And the code will look like this:

    <div class="top__wrap">
       <?php if ( have_rows( 'top_item' ) ):
         while( have_rows('top_item') ): the_row();
         $value = get_sub_field( 'value' );
         ?>
         <div class="top__item"><?php echo $value ?></div>
       <?php endwhile; endif;?>
     </div>
    
    <div class="bottom__wrap">
     <?php ( have_rows( 'bottom_item' ) ): ?>
       <?php if ( have_rows( 'bottom_item' ) ):
         $symbol = get_sub_field( 'symbol' );
         ?>
         <div class="bottom__wrapper">
          <div class="bottom__item"><?php echo $symbol ?></div>
         </div>
       <?php endwhile; endif; ?>
    </div>

    I hope this works for you guys as well!

  • There was another issue in another topic where someone has the same problem. I could not work out there either what the issue is. But it appears to be limited to specific installations. I would suggest to anyone that is having this issue to submit a support ticket and maybe the regular support team can work out what’s going on. https://support.advancedcustomfields.com/new-ticket/

  • I know this is old but i came across this in Google when looking for a solution to the same problem.

    My issue was that I had a WP Query loop in between the two repeaters, and the loop wasn’t reset. I missed it because I had that particular code block collapsed! (rookie mistake).

    Adding wp_reset_query(); after the loop resolved it and the second repeater is now working as expected.

    Hope this helps someone else.

  • Hello, I’m facing the same issue here.
    while using 2 repeater and one group acf field and querying multiple custom post type in the same page .
    Everything looks good till I add the second repeater , the first repeater crashes and one custom post also crashes.

    I tried to add wp_reset_query(); and reset_rows();
    But nothing works

    Hope to someone explain how really acf sends data to pages to understand what happening

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

The topic ‘Multiple Repeater fields on single page wont work’ is closed to new replies.