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); ?>
</div>
</div>
</div>
</article>
<?php endforeach;
endif;
Take a break and rest your brain 🙂
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.