Skip Navigation

[Resolved] Display content from a Many-to-Many relationship inside a related Parent-Child

This support ticket is created 2 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by claudiaP 2 years, 2 months ago.

Assisted by: Luo Yang.

Author
Posts
#2476289

I'm building a query that has several relationships.

First there are the parent companies (Practice). Each Practice can have multiple locations (Locations). I've created a Parent -> Child relationship between Practices and Locations.

Separate from that, each location (Locations) has multiple physicians (Physicians). The physicians can also work at more than one location, so I created a many-to-many relationship between locations and physicians.

What I would like to do is create a view where I select a Practice in the query filter. Then I'd like the view to display all of the Physicians who work for that Practice.

To accomplish this I created a view that filters out one practice using a Post ID filter. Then I created a nested view that selects posts in a Physicians at Locations relationship that are related to the Post where this view is shown.

Unfortunately this isn't showing me any results. Am I going about this the right way? Is this something that can be done?

If yes I'll share website credentials. Thanks!

#2477309

Hello,

Since there isn't direct relationship between "Practice" and "Physicians", It needs nested views, for example:
1) Parent post view:
- Query "Locations" posts
- Filter by post type relationship between "Practice" and "Locations"
- In view's loop, display below child post view

2) Child post view:
- Query "Physicians" posts
- Filter by post type relationship between "Locations" and "Physicians"
- In view's loop, display "Physicians" post information

3) In single "Practice" post, display above Parent post view

#2478033

My issue is resolved now. Thank you!