Home › Forums › Add-ons › Repeater Field › Get post ID from Post Object in Repeater Field › Reply To: Get post ID from Post Object in Repeater Field
Hi Eliot,
I figured it out — with your guidance of course!
I updated the code based on your sample that takes just one selection to the following:
<?php while(the_repeater_field('home_clients_logos')): ?>
<?php $clientLink = get_sub_field('client_link'); ?>
<li><a href="<?php echo get_permalink(28); ?>
<?php if( $clientLink ) : ?>
<?php $post = $clientLink; ?>
<?php setup_postdata( $post ); ?>#<?php echo get_the_ID(); ?>
<?php wp_reset_postdata(); ?>
<?php endif; ?>"></a></li>
<?php endwhile; ?>
I replaced:
<?php the_sub_field( 'client_link', $post->ID ); ?>
with:
<?php echo get_the_ID(); ?>
Thanks again for your help and super-quick response!
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.