Support

Account

Home Forums Add-ons Repeater Field Repeater Data Not Displaying

Solved

Repeater Data Not Displaying

  • Hi, sorry if this is a regular question, but I’ve only been working with WP for a little while now and things are still new to me. I’ve used the Custom Fields plugin on previous projects and it’s perfect. This time I wanted to try and streamline my code by using a repeater field in some places.

    Below is the complete code for the home page template, everything is working perfectly, no errors, except nothing is showing above “secondary_content” in “.col-2”.

    I expect it’s something basic, but I’ve not been able to find the answer.

    <?php get_header(); ?>
    
    <div class="col-1">
    
    	<?php if ( have_posts() ): ?>
    		<?php while ( have_posts() ) : the_post(); ?>
    			<?php the_content(); ?>
    		<?php endwhile; ?>
    	<?php endif; ?>
    	
    </div>
    <div class="col-2">
    
    	<?php if( get_field('award_logos') ): ?>
    		<h2>Awards & Accreditations</h2>
    		<ul id="awardsList">
    	 
    		<?php while( has_sub_field('award_logos') ): ?>
    			<li><img src="<?php the_sub_field('award_logo'); ?>" alt="" /></li>
    		<?php endwhile; ?>
    	 
    		</ul>
    	<?php endif; ?>
    
    	<?php the_field('secondary_content'); ?>
    	
    </div>
    
    <?php get_footer(); ?>

    Thanks in advance.

  • Hi @JFK

    It is possible that one of the followin is causing the issue:
    * Your ACF functions are place outside the posts loop – All code relevant to the post should be within the loop
    * Double check that award_logos is the correct field name for the repeater field

    You can also debug the repeater field value like so:

    
    <?php 
    
    echo '<pre>';
    	print_r( get_field('award_logos') );
    echo '</pre>';
    die;
    
     ?>
    
  • Oh wow, how embarrassing.

    It was a long day yesterday and I seem to have missed the ‘s’ off the end of “award(s)_logos”…

    Sorry to bother you and thank you for your help! 🙂

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

The topic ‘Repeater Data Not Displaying’ is closed to new replies.