Home › Forums › General Issues › Loading a field with a Relationship field within a Flex Content Field › Reply To: Loading a field with a Relationship field within a Flex Content Field
Hi Elliot,
Thanks for your quick reply. But I’m quite sure that would’nt work.
The thing is, all this code is loaded on a page. The customer post objects are loaded in the foreach loop created with the relationship field. So the $post->ID variable should come out of the postdata within the foreach loop. If I would place it outside, the $post->ID from the page it’s all being load on would be used instead of the customer post objects.
The weird thing is, the customer post objects $post->ID works for the post thumbnail:
<?php $thumbid = get_post_thumbnail_id($post->ID); ?>
But it doesn’t work when I call the custom field by that same $post->ID in the same foreach loop.
<?php $customer_url = 'href="' . get_field('customer-url', $post->ID) . '"'; ?>
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.