Home › Forums › Add-ons › Repeater Field › Post Object in Repeater only displaying first instance in loop › Reply To: Post Object in Repeater only displaying first instance in loop
I’m not really sure how you’re even seeing one. If you have the post pbject field set up to allow multiple selections then it should be returning and array.
<?php if( have_rows('select_mix') ):
while (have_rows('select_mix')) : the_row(); ?>
<?php $post_object = get_sub_field('mix_character_select'); ?>
<?php if( $post_object ): ?>
<?php
foreach ($post_object as $post) {
setup_postdata( $post ); ?>
<h2><?php the_title(); ?></h2>
<p>
<?php the_field('mix_description'); ?>
</p>
<?php
} // end foreach post
endif; ?>
<?php endwhile;
endif; ?>
<?php wp_reset_postdata(); ?>
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.