I have created a relationship between my custom posts Work and Talent using Advanced Custom Fields.
I am currently showing posts from Talent on my work pages with the following posts:
<?php
$artist = get_field('artist');
?>
<?php if( $artist ): ?>
<ul>
<?php foreach( $artist as $artist ): ?>
<li>
<a href="<?php echo get_permalink( $artist->ID ); ?>">
<?php echo get_the_title( $artist->ID ); ?>
</a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
However I would like to be able to show/pull-through a field that is in my artist sections on my work pages. I have tried doing the below but it doesnt work:
<?php
$artist = get_field('artist');
?>
<?php if( $artist ): ?>
<ul>
<?php foreach( $artist as $artist ): ?>
<li>
<a href="<?php echo get_permalink( $artist->ID ); ?>">
<?php echo get_the_title( $artist->ID ); ?>
</a>
<?php the_field( 'artist_summary' ); ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>