Support

Account

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) . '"'; ?>