Skip Navigation

[Resolved] Displaying post relationship problem

This thread is resolved. Here is a description of the problem and solution.

Problem: I have 3 post types related in one-to-many relationships like grandparent > parent > child. I can show a list of parent posts on the grandparent post, but I would like to show a list of child posts for each of the parent posts. How can I do it with one View?

Solution: You must use two nested Views. In the nested View, add post relationship filter where the parent is set by the current post in the loop.

Relevant Documentation:
https://toolset.com/documentation/user-guides/using-a-child-view-in-a-taxonomy-view-layout/

This support ticket is created 6 years 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by michaelH-31 5 years, 12 months ago.

Assisted by: Christian Cox.

Author
Posts
#1192767
ListCapture.PNG

I have set up a 3 level post-type relationship structure -- States > Counties > Cities.

The one thing I'm having problem with is the design of a specific view I require.

I want displayed on State's pages an unordered list of the various State's Counties (this I can do without a problem), PLUS a sub list of each County's Cities under their respective Counties.

To put it another way, I know how to build a separate view for the County's list of States. And the City's list of Counties. I just can't figure out how to join the counties and cities in one view.

Attached is a screen shot of what I want to achieve. (It's obviously formated with css and javascript)

Thanks

#1192773

I just can't figure out how to join the counties and cities in one view.
Hi, I can't see a screenshot but I think I understand what you're trying to accomplish. You can't do it with just one View. You must create a second View and nest it inside the loop of the first View - resulting in a loop within a loop. The second View should be configured like this:
- In the initial View popup, choose "Full custom display"
- Content selection should be "Cities" posts
- Add a Query Filter by post relationship, choose the County > City post relationship, and configure the parent to be set by the current post in the loop.
- In the Loop Wizard, choose "unordered list" and insert the post title with a link (or whatever you want to display for each City)
- Insert the View of Cities in the Loop of the View of Counties, just after the County post title.

More information about nested Views: https://toolset.com/documentation/user-guides/using-a-child-view-in-a-taxonomy-view-layout/

Let me know if I've misunderstood your request.

#1192789

My issue is resolved now. Thank you!