Home Forums Add-ons Repeater Field Only 1 of 6 repeaters shows


Only 1 of 6 repeaters shows

  • Hello! I’m new to ACF and have spent many hours trying to figure out what’s going wrong with my repeater loop. I have a tabbed ACF setup. Each tab has many fields and 1 repeater field that are all identical except for a change in the number in the field name (e.g. tab_1_cards, tab_2_cards… up to 5 tabs total). It’s my understanding that the sub fields of the repeaters can have identical names as long as the top level field name changes.

    The issue is that the first repeater shows as I expect, but none of the other repeaters display any content. Does anyone have an idea why this might be?

    $tabcount = 1;
    while( $tabcount < 6 ): ?>
    	<div id="tabs-<?php echo $tabcount ?>">
    		<div class="content-wrapper">
    			<!--	Display cards for tab	-->
    	<?php if( have_rows('tab_' . $tabcount .  '_cards') ): ?>
    		<div class="cards">
    			<?php while( have_rows('tab_' . $tabcount .  '_cards') ): the_row(); 
    				// display a sub field value
    				$image = get_sub_field('card_image');
    				$link = get_sub_field('page_link');	
    				$content = get_sub_field('card_description');
    				$title = get_sub_field('card_title');
    				<div class="card">
    				<?php if( $link ): ?>
    					<a class="overlay-link" href="<?php echo $link; ?>"></a>
    				<?php endif; ?>
    					<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt'] ?>" />
    					<h5><?php echo $title; ?></h5>
    					<h6><?php echo $content; ?></h6>
    			<?php endwhile; ?>
    	<?php endif; ?>
  • I don’t see anything that sticks out in your code that would cause the issue.

    The first thing I’d do is make sure that each of these repeaters has content and that content is being retrieved by ACF.

    $tabcount = 1;
    while ($tab_count<6) {
      echo 'TAB '.$tabcount;
      echo '<pre>'; print_r(get_field('tab_'.$tabcount.'_cards');
  • Well, I’m not really sure what was going on. I tried to troubleshoot it and I made sure all content was entered in. the next day, more of the content was showing. Today, everything but the images on tab 4 were showing, so I went into the page, deleted all the images and re-inserted them, which didn’t help. I double checked the repeater images for that tab and set them to Required and then they started showing.

    thank you for trying to help. I’m still lost on this, but happy it’s working now.

  • By your description I would suspect some type of caching issue, but honestly, I don’t really know.

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

The topic ‘Only 1 of 6 repeaters shows’ is closed to new replies.