Post thumbnail within ACF repeater -> post object
-
I’m trying (and failing) to get the thumbnail from a post object chosen by an Advanced Custom Field Repeater. I get all the other post items just fine.
This is what I got this far but clearly i’m not on the spot:
<?php
$post_object = get_sub_field(‘flow-post’);
if( $post_object ):
// override $post
$post = $post_object;
setup_postdata( $post ); ?><img src=”<?php the_post_thumbnail($post->ID, “medium”); ?>”>
<h4><?php the_title(); ?></h4>
<?php the_excerpt(); ?>
</div>
<?php wp_reset_postdata(); // IMPORTANT – reset the $post object so the rest of the page works correctly ?>
<?php endif; ?><?php else: ?>
The topic ‘Post thumbnail within ACF repeater -> post object’ is closed to new replies.