Thanks for creating relationship. I am testing for a network of tourist guides sites of small destinations in Chile and I find myself with some doubts.
Create a relationship of one is to many. For example, a locality has many attractions.
Now I have created a shortcode in a view that filters the attractions in a specific locality and that shortcode inserts it in a new page created by myweb.com/atractivesofthelocality. Until here everything perfect.
I expected to see:
The problem exists when I want to do this on a large scale, according to this example, I have to create one by one the views to show on a page attractive in a locality, or activities in a locality or etc, in a site that has more than 100 locations its a big problem.
Is there any way to create 1 single view for example of attractions in the locality, and in the shortcode or other place to be able to change what custom post types should show ?. Or can I create an attractive view, but in the shortcode can I change which location I want to show the entries?
So far I have only encountered examples of displaying custom post types entries depending on where the shortcode is located. For example insert the shorcode in the entrance of the locality filtering the view so that it shows the results according to where this insert.
Let me clarify one thing about Views, which is that the post type is set when you create the View and cannot be modified (unless you write some code using the API to modify the query).
You can pass arguments to Views to provide values for the filters, either by shortcode attribute (you add an extra attribute to the wpv-view shortcode where the View is inserted) or by URL parameter.
Note, from your debug info it looks like you are using Layouts. You cannot use shortcode arguments if you are not using a shortcode to insert a View, which means if you are adding a View to a Template Layout you must insert the View using a shortcode into a Visual Editor cell, and not use a View cell.
For a situation where you have a location connected to multiple attractions, you would typically create a View to show attractions and include a relationship filter to show only attractions connected to the current location, with this View inserted into a template for locations, so that whatever location post you viewed on the front-end it would show the attractions connected to that location.
But if you want to display such a View on a different page that is not the location post you can pass the id of the location you want to refer to as a shortcode attribute. In your View add a filter for the relationship and specify that the location comes from a shortcode attribute. It will suggest a name for the attribute (which you can change) and then add this attribute when you insert the View with the wpv-view shortcode.