Thank you very much @hube2. This code made it. Now it’s working perfect.
Thank you very much!
_
Hi @hube2 ,
1) the return value for the relationship field is set to “Post Objet” and I’m allowed to select more than one, but I’m always selecting just one “film-negative”.
2) I’m using the standard WP Featured image.
thank you.
uhmm, I’m saving the post but nothing happening.
just to make it clear for me, I should change the code just on: ‘relationship_field_name’ because the cpt name is already there: ‘print-size’ ?
Hi @hube2 , thank you very much for your time.
If I understand correctly, I should paste this code on my function.php, and then where says ‘relationship_field_name’ I should write the relationship field from where I’m interested to get the thumbnail image? Because if it’s the case, it’s not working for me.
Then the image should appear in “featured image” on my “print-size” cpt without doing a thing, isn’t it?
Finally, I resolved it like this, on the second query inside the loop
<?php $negatives = get_field( "collections_single_work"); ?>
<?php if( $negatives ): ?>
<?php foreach( $negatives as $post ): ?>
<?php setup_postdata($post); ?>
here goes some coding
<?php $related_posts = get_field('collection_edition_size');
if ($related_posts) {
foreach ($related_posts as $related_post) {
?>
<?php if( get_field('size_of_the_negative', $related_post->ID) == '4x5'): ?>
here goes some coding
<?php
}
} ?>
here goes some coding which is part of the first loop
<?php wp_reset_postdata(); endforeach; ?>
<?php endif; ?>
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.