Support

Account

Home Forums Add-ons Repeater Field Repeater field rows don't show up Reply To: Repeater field rows don't show up

  • Hey Jonathan, thanks. So, now my code looks like this:

    <?php $posts = get_posts(array(
    				'numberposts' => -1,
    				'post_type' => 'gameresults',
    				'orderby' => 'title',
    				'order' => 'ASC'
    				));
    				
    				setup_postdata();
    				if($posts)
    				 {			 
    					foreach($posts as $post)
    					{
    						?>
    						<h3 style="margin-top: 0px;">
    						<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
    
    						<?php if(get_field('game_results_repeater'))
    							{
    								echo '<ul>';
     
    								while(has_sub_field('game_results_repeater'))
    									{
    										echo '<li>sub_field_1 = ' . get_sub_field('game_results_home_team') . ', sub_field_2 = ' . get_sub_field('game_results_home_score') .', etc</li>';
    									}
     
    								echo '</ul>';
    							}
    					  }
    					wp_reset_postdata();
    				 } ?>
    

    But when I load the page, I get this error:

    Warning: Missing argument 1 for setup_postdata(), called in /home/lcbiskca/public_html/wp-content/themes/lcbi/sidebar-scores.php on line 20 and defined in /home/lcbiskca/public_html/wp-includes/query.php on line 3625

    Any ideas? It seems like setup_postdata() needs to have an argument, so I inserted $posts but, still, nothing appears.

    Thanks again for any help you can give.