Skip Navigation

[Resolved] Search by grandparent value, parent value, and post value

This support ticket is created 6 years, 5 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 1 reply, has 2 voices.

Last updated by Luo Yang 6 years, 5 months ago.

Assisted by: Luo Yang.

Author
Posts
#1094087

Tell us what you are trying to do?
-My post types and relationships:
--Seasons (1) => Competitions (many)
--Competitions (1) => Results (many)

-My goal:
--Create a search form that allows a user to search on a field from Seasons, a field from Competitions, and several fields from Results. The search should display Results that match the criteria (ex. Season Name = '2018', Competition City = 'City A', Results Studio = 'Studio A', Results Dancer = 'Dancer A'

Is there any documentation that you are following?
-I searched your support and this is what I found: https://toolset.com/forums/topic/parentchild-relationship-in-custom-search-and-post-form/. I don't, however, understand how to translate this into what I have.

Is there a similar example that we can see?
-hidden link is actually showing Results (even though the name is photos...I'm just re-using results to show something different)

What is the link to your site?
-hidden link is the development version of the site.

#1094639
relationship-filter.JPG

Hello,

Yes, it should be possible within Toolset plugins, see our live demo site:
hidden link

In section "Search Houses Use filters", there are two filters:
- State
- City

Which is similar as your case, you can also create your own real-estate demo site here:
https://discover-wp.com/site-types/bootstrap-estate-layouts/

In your case, you just need to setup below post type relationship:
- one-to-many relationship between post types "Seasons" and "Competitions"
- one-to-many relationship between post types "Competitions" and "Results"

Then create a view querying "Results" posts, and in section "Search and Pagination", add a post relationship filter, see screenshot: relationship-filter.JPG