I am trying to create a custom author block on my wordpress website. The website is build on elementor. With the use of ACF I created a relationship (our_people_author) between the blog posts and custom post type (our people) - which contains posts presenting people.
I would like to add this code to functions.php or turn it into a shortcode but I am getting an error. Would anyone be able to help me with it?
$authors = get_field('our_people_author');
<?php foreach($authors as $author):?>
<img src="<?php echo get_the_post_thumbnail_url($author->ID, 'thumbnail');?>">
<h3>
<a href="<?php echo get_page_link($author->ID);?>">
<?php echo $author->post_title;?>
</a>
</h3>
<?php endforeach;?>
You are missing this
setup_postdata( $author );