Support

Account

Home Forums ACF PRO Post Object within taxonomy. Reply To: Post Object within taxonomy.

  • This code` <?php

    $posts = get_field(‘related_series’, $taxonomy . ‘_’ . $term_id);

    if( $posts ): ?>
    <ul>
    <?php foreach( $posts as $p ): // variable must NOT be called $post (IMPORTANT) ?>
    <li>
    <a href=”<?php echo get_permalink( $p->ID ); ?>”><?php echo get_the_title( $p->ID ); ?><?php the_post_thumbnail( ‘featured’ ); ?></a>

    </li>
    <?php endforeach; ?>
    </ul>
    <?php endif; ?>`

    I used the example link: https://www.advancedcustomfields.com/resources/relationship/
    And I added to get the featured image from the related post. However, he repeats the same image for all posts. This is not a repeater field. I’m doing the test without the repeater field.