***Tell us what you are trying to do?***
Currently we have three different custom post types: clinics, therapists, and treatments.
Right now they are all separate posts types(not using intermediate posts).
"clinics" and "therapists" are self-explanatory, and "treatments" are the treatments offered by each clinic. Currently, the treatments are connected directly to each clinic, but we are trying to adjust things so that treatments are connected to each therapist, so that if a therapist is moved to another clinic, the treatments are moved automatically.
I was able to successfully add a relationship between therapists and treatments, and successfully show each treatment connected to a therapist in a view. So I am able to list all physical therapists on the clinic page, along with the treatments they offer.
The problem that I am having is displaying a combined list of all the treatments connected to therapists, that are connected to that clinic. I can get them all to show up by creating a view of all connected therapists, that in turn shows all connected treatments, but then I get duplicates because multiple therapists can be connected to the same treatments(because multiple therapists might be accredited to treat concussions, for example).
Is there a way that I can filter the total list of treatments for each clinic through that loop so as to get rid of duplicates? Or is there a completely different way that I should be doing things to display this information?
***Is there any documentation that you are following?***
It seemed like there were somewhat similar support tickets that others had submitted, where they were trying to filter within loops, but they seemed different than my use case.
I'm essentially trying to do the opposite of this support ticket(filtering child info from parent view, instead of filtering parent info, from child view :
https://toolset.com/forums/topic/remove-duplicate-parents-from-views-loop-with-wpv_filter_query_post_process/
It sounded like there was a simple solution when only a simple list is needed, which is what I'm trying to achieve, but that solution was not shared because the original poster was looking for a solution that would work with a complex grid.
I was reading some of these articles to try and come up with a solution:
https://codex.wordpress.org/The_Loop#Multiple_Loops_in_Action
https://toolset.com/documentation/legacy-features/views-plugin/using-shortcodes-in-conditions/