I’m not sure if I’m not understanding your code or if I didn’t explain my problem properly. I believe I am already able to output what you have suggested with a query like this(?):
$args = array ( 'post_type' => 'stockists', 'post__in' => $participating_ids, 'meta_key' => 'stockist_address_0_stockist_country', );
This gives me a list of stockists, as does your code — as far as I can tell.
I need a list of countries but only if they are on posts that have the relationship. Then also the country should only appear once. I am trying to use them as headings for the stockists in the promotion e.i.:
I was just asking about the first part of getting the countries to list out but I would then make sure the nested loop only outputted stockists in the country AND the current promotion relationship.
I’m no programmer so forgive me if I’ve missed if your solution is actually doing that.
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!
© 2022 Advanced Custom Fields.