I have a set of custom post types Resource and Agency. Agency is a parent of Resource as one Resource can be shared across multiple agencies. They both share a set of categories and tags and a couple fields. I want to create a search form that allows users to search both types. However, I would also like them to have the option of narrowing the search to only Resources for a given Agency.
So, my form has 3 filters Category, Tag and Agency. When I search on Category and Tag, everything is fine. I get any custom post associated. However, when I select an Agency, I get no results. I've added screenshots showing the output of searches. The first shows the unfiltered list, the second the list is filtered by categories, and the last adds the Agency. There should be one resource in the last list because the NOAA Sea Level resources belongs to the selected agency.
Basically, if a user selects a specific Agency from the drop down, the search function should ignore the Agency post type and focus on the Resource type only.
Also, note that I am using the beta version of types and views because it allows for many-to-many relationships. Any help would be appreciated. Thanks,
Joe
I've tried the solution listed in the linked post; however, I'm still having difficulty. I think I may need to rephrase my question.
I have a View that queries two post types: Agency and Resource. Agencies are parents of Resources.
If a user selects a category in the search filters, it should show any Resource or Agency that has that category. This works fine.
Another one of the filter options I added to the page filters based on a relationship. I want to be able to filter the results by parent agency. So, if a user selects a category and an Agency, only the Resources within that Agency should show up. This breaks.
Whenever I add an Agency to the query, I get blank results. It seems like the relationship query is causing a problem. Is there a way to include a relationship query in a search for multiple post types? Thanks,
Joe