Hi there, I've three posts types: A, B (child of A) and type C (child of B)
A->B->C
I've to print all the posts C given their grand father A. To achieve this I've made two views: one printing all C type given their father B and another view printing all B type given their parent A. In the content template of this second view I call the other view.
Doing this way given an A post I can print all its children and children of its children.
Now I'd like to filter by a field of C type with just one filter form that filters at the same time all the B->C views I've foreach A->B children, how could I do that?
Is there another way to display and filter descendants C posts from a certain A post?
e.g. select * from A join B join C where c.date="filter"
The new versions of Types and Views with enhanced post relationships will expand the abilities to filter one post type by fields of connected posts which is currently not possible, but I'm not sure even that helps you here.
The only solution I can think of is to set up your nested Views with the same query filters where the value comes from a URL parameter.
You insert the filter controls with the outermost View, and then manually add the same query filter to the other Views without inserting the controls themselves.
For this to work you must use page reload rather than ajax to update the results, so that each View reacts to the URL parameter.
it's what I've done, but there is something wrong.
I've placed string filter in the outer view, and a filter (descr) in the inside views and works.
I made a between date filter and that instead doesn't work:
here the url I've upon submit /certificati/?descr=&wpv-wpcf-data_min=1520035200&wpv-wpcf-data_min-format=F+j%2C+Y&wpv-wpcf-data_max=&wpv-wpcf-data_max-format=F+j%2C+Y&wpv_view_count=73-TCPID77CPID28&wpv_post_search=&descr=&wpv-wpcf-data_min=1520035200&wpv-wpcf-data_min-format=F+j%2C+Y&wpv-wpcf-data_max=&wpv-wpcf-data_max-format=F+j%2C+Y&wpv_filter_submit=Invia
It's not easy for me to see why this isn't working from the above alone, it would be helpful to see your site and examine the set-up directly if that's possible.
I will mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site, even though I don't intend to make any changes.
Can you confirm the which page you have added the Views to.
I checked your set up and have been experimenting on a local test site to see if I can get this working.
It works okay on the initial submission, but modifying the filter values and re-submitting doesn't work because multiple copies of the same URL parameter keep getting added each time.
I'm trying to find a way of preventing that, I'll update you again with my findings.
I looked at ways of preventing the URLs from being appended and couldn't get anything to work, so I consulted with the lead developer and he said that it is not possible and that what I suggested—moving the filter controls from one View to another—is not supported and will not work because each View has a unique fingerprint to prevent just that.
So, I'm sorry for having encouraged you to try that. I expected that it would work but, as we have found and is confirmed the the developer, it doesn't.
I don't have any alternative for what you are asking, it's not possible I'm afraid.
The Types 3.0 and accompanying Toolset updates will make it possible to filter posts by fields from related posts (including indirect connections such as grandparents), although filtering multiple Views using a single filter control form is not part of the update.