Skip Navigation

[Resolved] View Output Query Filter for Parent Posts using Child

This support ticket is created 2 years, 8 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 shellyS-2 2 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#2447681
Screen Shot 2022-08-30 at 12.59.41 PM.jpg
Screen Shot 2022-08-30 at 12.54.14 PM.jpg
Screen Shot 2022-08-30 at 12.54.37 PM.jpg
Screen Shot 2022-08-30 at 12.56.06 PM.jpg

Hello- I am trying to display posts (A) that are using a child post relationship with hierarchal post (B) using Blocks > Views on an unrelated page. Can you please assist in the correct Content Selection and Query Filters to accomplish this please.

Here is my setup:
Post Type A = Community
Post Type B = City & Neighborhood
Post Type B has hierarchy setup with Parent posts. Example: Parent post = St. Paul (city) and child post = Highland Park (neighborhood).

Instead of creating queries for all child posts (neighborhoods), I'd like to say: display all Communities (A) that are related to City (B) via a Neighborhood (B child).

Thank you!

Screenshots here:

#2447821
post-parent-filter.jpg

Hello,

I assume we are talking about this case:
1) Two post types:
- City & Neighborhood (hierarchal post type)
- Community

2) One-to-many relationship between "City & Neighborhood" and "Community"

If it is, you can try with nested view:
1) Parent post view:
- Query "City & Neighborhood" posts
- Filter with:
Select posts whose parent is the page where the View is shown.
see my screenshot post-parent-filter.jpg
- In view's loop, display below child post view

2) Child post view:
- Query "Community" posts
- Filter with:
Select posts in a Cities Hoods to Communities relationship that are a related to the current post in the loop.
- In view's loop, display "Community" post information

In the "City" post, display the parent post view

#2448123

Thank you Luo Yang, this helped me find the correct solution.