I am trying to create a search using a relationship. So I tried to follow the steps:
1. Edit the page that holds your View with a custom search.
2. In the View editing area, click the Add Search Field button.
3. In the dropdown that appears select the Post relationship or repeatable field groups owner option.
4. In the right sidebar, expand the Field Settings section and use the dropdown menu to select the relationship you want to add a filter for.
When I get in the 4th step, I can´t find the relationship to select. There is a message: "There are not futher ancestors defined". What should I do?
How can I add a relationship as a custom field to be included in more than one post types?
1. what relationship do you refer to? (What kind of relationship, e.g. one-to-many, many-to-many, and which post types are connected in the relationship.)
2. the View you are trying to add a relationship search filter for, what does the View display? (What post type does the View query?)
I have 2 post types related: "Counties" And "Parks". Some Parks are located in two or more Counties and some Counties have more than one Park. That is why I choose a many-to-many relationship.
I also have a third post type: Facilities. I would like that the user when searching for facilities in a park area could select the counties related to the park individually. Park would be the parent and counties the child.
How can I add the post type "Park" as a custom field of the post type "Facilities" to show a list of all the parks in a dropdown selector and, after selecting the Park, how can I show the counties related?
What I am trying to do is a cascading dropdown where Parks would be parents and Counties related to parks would appear as its child in a way that the user when searching for a facilitie in a Park could select "all the park" or a specific countie of the park.
But from what I read in the forum, it is not possible to build a cascading dropdown. Is there a way?
What you're trying to achieve may not be possible, directly. But I can recommend a workaround or alternate approach.
Can you please share temporary admin login details, along with the link to the Facilities search page? I'll be able to suggest the next steps, accordingly.
Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.
Reviewing the existing setup, here is the closest possible option that I was able to deploy.
1. I've created a 'many-to-many' relationship between the 'Facilities' and the 'Parnas Directories' post types.
2. Next, in the archive for the 'Facilities search', I've included the relationship search filter, which consists of two levels:
- Facilities Parnas Directories
- Parnas Directories Hotels
( screenshot: hidden link )
On the front end, you can see that the two interlinked forms are showing for these relationships.
( screenshot: hidden link )
I hope this helps and please let me know if you need further assistance.