Hi,
I have a select field with values 1,2 and 3. When I use that field in filters I can set a single filter only, the "Add another value" button doesn't appear so I cannot add a filter like "field is a number equal to 1 or 2". Why so ?
Thanks Regards
Nicola
Hello,
I assume we are talking about custom search form, you are going to setup a multiple select input for custom select field.
If it is, it is possible, for example, your custom select field is using slug "test-se1", you can edit the post view, and try these:
1) In section "Search and Pagination", setup the multiple select input like this:
[wpv-control-postmeta type="multi-select" field="wpcf-test-se1" url_param="wpv-wpcf-test-se1"]
2) In section "Query Filter", setup the filter as below:
Select items with field:
test se1 is a string in URL_PARAM(wpv-wpcf-test-se1)
Please replace "test-se1" with your custom select field slug, and test again.
More help:
https://toolset.com/documentation/user-guides/views/filtering-views-by-custom-fields/
https://toolset.com/documentation/user-guides/views/views-shortcodes/#wpv-control-postmeta
Hello Luo Yang,
much simpler than that. I am just filtering posts in a view, no custom search form (see picture). I have a NEWS CPT and I created a Target field with 3 values: 1=Users, 2=Companies, 3= All. I just want to show in one view news for 1 and 3 and in another view news for 2 and 3. I was expecting that the "Add another value" button was available.....
Thanks
Regards
Nicola
Dear Nicola,
In this case, you can switch to "in" comparison, just like your screenshot:
https://toolset.com/wp-content/uploads/2020/04/1605259-zzz.png
under "YOUR EXAMPLE".
It should be able to work as you request: field is a number equal to 1 or 2.
See the document I mentioned above:
https://toolset.com/documentation/user-guides/views/filtering-views-by-custom-fields/
IN
A list of values
Checks if the custom field value is within the list of compare values
My issue is resolved now. Thank you!