Hi,
Could you please help me with the following:
I have the following data structure:
- Post types: Activities + Locations
- Relationship: Location-Activity (Many-to-Many)
I am trying to create a view in which users can select Activities based on the following filters:
1. Activity Type (Taxonomy Activities)
2. Location (Relationship filter Location-Activity)
3. Location Type (Custom Field Locations)
When I create a new filter and select Location Type Toolset creates the following code:
<div class="form-group">
<label>[wpml-string context="wpv-views"]Locatie type[/wpml-string]</label>
[wpv-control-postmeta field="wpcf-locatie-type" url_param="wpv-wpcf-locatie-type"]
</div>
This field however doesn’t seem to have a relationship with the other filter fields or result (activities). After refreshing the page location types can be selected, but after selecting an options, no results are shown. Also when I select an activity type, the location types are not automatically updated.
Please advice.
Best regards, Annemarie
just changed the order of the attached images
Hello,
There isn't such a built-in feature within Views plugin, Views is using wordpress class WP_Query to query the posts, In your case, you are using view to querying the "Activities" posts, so you can only filter the result by the custom fields/taxonomies of post type "Activities", since there isn't "Location Type" field in the "Activities" post, so it is expected result:
after you select a "location types" options,no results are shown.
So when it is querying posts one post type "Activities", and filter the result by fields of anther post type "Locations", you can only filter the result by custom fields/taxonomies of post type "Activities".
It is a wordpress limitaion:
https://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters
Thank you for your response. I'm afraid I will have to find another solution.