Problem: I have a 3-level custom post type relationship hierarchy - grandparent > parent > child. On my single grandparent post page, I would like to display a View of child posts, with a custom search filtered by parent. By default, all the children of the current grandparent should be displayed, and the user should be able to select a parent as a filter.
Solution: There are two options: use a URL parameter and a post relationship filter, or use two nested Views.
URL parameter approach: Create a View that shows child posts, filtered by Post Relationship (grandparent > parent). Set the filter query to respond to a URL parameter. Apply this URL parameter to all links to the grandparent single post page:
http://yoursite.com/state/washington?wpv-post-relationship-state=57273
Nested View approach: Create a View that shows child posts, filtered by post relationship, where the parent is the current post in the Loop. In the Loop Output, add the information you want to display about each child post. Then, create a View that shows parent posts, where all parents are children of the current grandparent post. Insert the child View into the Loop Output of the parent View.
Relevant Documentation: https://toolset.com/documentation/user-guides/creating-post-type-relationships/
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 15 replies, has 2 voices.
Last updated by 7 years, 2 months ago.
Assisted by: Christian Cox.