Home › Forums › ACF PRO › Repeater with Post Object not returning expected results. › Reply To: Repeater with Post Object not returning expected results.
Got it working with this. Hope it helps someone.
<?php if ( have_rows( 'profile') ) : ?>
<div class="container px-5 mx-auto flex flex-wrap">
<div class="flex flex-wrap -m-4">
<?php while ( have_rows( 'profile' )) : the_row(); ?>
<?php $profile_link = get_sub_field( 'profile_link' );?>
<?php if ( $profile_link ) :
$permalink = get_permalink( $profile_link->ID );
$title = get_the_title( $profile_link->ID );
$creds = get_field( 'creds', $profile_link->ID );
$headshot_id = get_field( 'headshot', $profile_link->ID ); // Profile headshot media id
?>
<div class="row w-48 mr-8" >
<?php echo wp_get_attachment_image( $headshot_id, 'thumbnail', '', ["class" => "twn-profile-pic mx-auto"] );?>
<p class='text-sm is-all-caps text-center mt-4'><?php echo $title; ?></p>
</div>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
<?php endwhile; ?>
</div>
</div>
<?php else : ?>
<?php // no rows found ?>
<?php endif; ?>
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.