Show related posts on single.php, grouped by taxonomy terms, with Advanced Custom Field post object selected

I’d recommend creating 3 separate [‘associated_items’] fields instead of 1.

For Example:

  • [‘associated_articles’] & “Filter for taxonomy term: Articles”
  • [‘associated_presentations’] & “Filter for taxonomy term: Presentations”
  • [‘associated_news’] & “Filter for taxonomy term: News”

Note: Filtering for the taxonomy term, limits the related posts available to choose from as well, which results in a better user experience

Then change the code above to be used for each field.
For Example:

<h2>Posts related to the Company</h2>
<?php $assoc_articles = get_field('associated_articles');?>
<?php if( $assoc_articles ): ?>
    <div class="relatedposts">
        <h3>Articles</h3>
        <?php foreach( $ass_articles as $article): ?>
        <?php setup_postdata($article); ?>
                <?php get_template_part( 'content', 'excerpt' ); ?>
        <?php endforeach; ?>
    </div><!-- div.relatedposts -->
<?php wp_reset_postdata(); ?>
<?php $assoc_presentations = get_field('associated_presentations');?>
<?php if( $assoc_presentations ): ?>
    <div class="relatedposts">
        <h3>Presentations</h3>
        <?php foreach( $assoc_presentations as $presentation ): ?>
        <?php setup_postdata($presentation ); ?>
                <?php get_template_part( 'content', 'excerpt' ); ?>
        <?php endforeach; ?>
    </div><!-- div.relatedposts -->
<?php wp_reset_postdata(); ?>
<?php $assoc_news = get_field('associated_news');?>
<?php if( $assoc_news ): ?>
    <div class="relatedposts">
        <h3>News</h3>
        <?php foreach( $assoc_news as $news_item ): ?>
        <?php setup_postdata($news_item ); ?>
                <?php get_template_part( 'content', 'excerpt' ); ?>
        <?php endforeach; ?>
    </div><!-- div.relatedposts -->
<?php wp_reset_postdata(); ?>

I’m assuming you are using the above code sample because you prefer it. However, if all you need is a link to the post, you don’t actually need to setup_postdata()… you could simply use the $post->ID and then just loop through the results using something like:

<?php foreach( $assoc_news as $news_item ): 
$news_ID = $news_item->ID; ?>
<li><a href="https://wordpress.stackexchange.com/questions/102201/<?php get_permalink($news_ID ); ?>"><?php get_the_title($news_ID ); ?></a></li>... etc

I hope that helps.