Skip Navigation

[Resolved] Can I display nested relationship content through another relationship?

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/Karachi (GMT+05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 7 months, 3 weeks ago.

Assisted by: Waqar.

Author
Posts
#2695827

I'm building a website that has nested relationships.

At the top is Hubs. Each hub can have several Locations, so I created a one to many relationship between Hubs and Locations.

The next relationship is between Locations and Providers. This is a many to many relationship as Providers can work at more than one location, and each location can hold more than one provider.

Currently those are the only relationships. A one to many between Hubs and Locations, and a many to many between Locations and Providers.

What I'd like to do is display all of the Providers at the Hub level. So if a Hub has 3 locations (one to many), and those locations each have 2 providers (many to many), I'd like to show all 6 providers in a view at the hub level.

Is there a way to do this as currently built - something like nested views? Or do I need to create a relationship between Hubs and Providers to accomplish this? Thanks for your help!

#2696067

Hi,

Thank you for contacting us and I'd be happy to assist.

Your understanding is correct and to achieve this, you'll need to use nested views. And since the nesting of views is not supported in blocks-based views, you'll create them using the classic views editor.

Here is a guide on the topic of nested views:
https://toolset.com/documentation/legacy-features/views-plugin/using-a-child-view-in-a-taxonomy-view-layout/

In summary, here is how these two views will be set up:

1. In the single 'Hub' template, you'll add the parent view that will show all 'Location' posts related to the current 'Hub'.

2. In the loop of this parent view, you'll add the second child view, which will show all the 'Provider' posts, related to the current 'Location' coming from the loop of the parent view.

I hope this helps and please let me know if you need further assistance.

regards,
Waqar

#2696601

This helped a lot - thanks!