Home Forums Add-ons Repeater Field Wrong content appearing… Reply To: Wrong content appearing…

  • Hiya,

    You’ve got 2 lines misplaced.

    <?php if( have_rows('home', 'option') ): $i = 0;
    						while( have_rows('home', 'option') ): the_row(); $i++;
    							$post_object = get_sub_field('choose_pages');
    							$post_object_icon = get_sub_field('choose_icon');
    							// these 2 lines should be in the loop
    							//$post = get_post($p->ID);
    							//setup_postdata( $post, $more_link_text, $stripteaser );
    							if( $post_object ):
    								foreach( $post_object as $p ): 
    									// move the lines here
    									$post = get_post($p->ID);
    									setup_postdata( $post, $more_link_text, $stripteaser );
    								<article class="hs-content" id="chapter<?php echo $i; ?>">
    									<div class="hs-inner">
    										<h2>Chapter <?php echo $i; ?>.</h2>
    										<h3><?php echo get_the_title( $p->ID ); ?></h3>
    										<div class="container-fluid">
    											<div class="row">
    												<?php the_content($p->ID); ?>
    								<?php endforeach;

    Take a break and rest your brain 🙂