Perfect. I want to do exactly what you said:
"If you would like to display the Rallies from Parks that have rating 4, you will need to create a view to query Parks based on the rating, then you can use a nested view inside its loop. The nested view needs to be filtered by the relationship to the current post in the loop."
Do you have an example of this nested view?
Gary
Awesome. Does it also need to be displayed on a map?
Currently, nested views creation is not supported at the moment inside the block editor. Check this screenshot hidden link
So I created a view with the legacy editor and configured it to display the Rallies of the current Park in the loop, check this screenshot hidden link
But, this has, actually, some limitations. Especially if you want to have the results on a grid. The parent view is created with blocks and is configured to display a grid of Parks. Then the nested view will display its results(Rallies related to the park) inside the park's grid cell, especially if a park has more than one rally. You may end up having grids inside grids. It may also have issues for pagination. Does it make sense?
Check my simple example result's in this screenshot hidden link
If you want to display each rally on a grid cell, and you have some parks with more than one rally, I'll suggest you build the parent view with the legacy editor. The loop code can then use Bootstrap classes to have the proper results. This solution may also present some pagination inconsistencies because the parent view is the one who controls the output.
There maybe another solution involving custom code, where we can use one view to query Rallies, and hook into the its query to make it search only within the parks that satisfies the search criteria. The solution will use the wpv_filter_query hook, the post__in WP_Query argument, and the toolset_get_related_posts relationship function:
- https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
- https://developer.wordpress.org/reference/classes/wp_query/#post-page-parameters
- https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts
I'll let you check the view that I have created. Let me know if you have any questions, and if the results should go into a map.