sure I wan’t to explain it more detailed.
I have got a category where now 4 articles should be listed. On every article I would like to display via the relationship the title of an other article which is connected via the relationship.
For displaying the title I use this code snipped
<?php $posts = get_field('myfieldname');
if( $posts ): ?>
<?php foreach( $posts as $post): // variable must be called $post (IMPORTANT) ?>
<?php setup_postdata($post); ?>
"><?php the_title(); ?>
<?php endforeach; ?>
<?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
<?php endif; ?>
The title would be displayed perfect.
But the other 3 Postings in this category won’t be published. Only the first article will be showen in the category. All articles which will be listed after the relationship snipped won’t be showen.
Have you got any idea?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2020 Advanced Custom Fields. Subscribe