Skip Navigation

[Waiting for user feedback] Multiple filters to use an AND rather than OR function

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 3 replies, has 1 voice.

Last updated by Minesh 38 minutes ago.

Assisted by: Minesh.

Author
Posts
#2785400

I'm trying to create new filters for my search view and archives.
I created all the filters but some of them seem to work using an AND function while others use an OR. It seems that the Topic, Language and Tradition filters work using OR, while the Times, Medium, Difficulty and Use use AND.

I want all of them to use an AND function. How can I do that?

Page: hidden link (need to click on 'Filters' to see the filters)

Code:

[wpv-filter-start hide="false"]
[wpv-filter-controls]

<div class="search-div newsearch">
<div>
<label class="search-box">[wpv-filter-search-box]<span class="nope">Search Box</span></label>
[wpv-filter-submit name="Search" type="input" class="search-submit"]
</div>

<dl class="accordion search-accordion">
<dt align="middle">
Filters
</dt>

<dd>
<div class="row">
<div class="col-6">
<div class="form-group search-topics">
<p>Topics (hold ctrl / ⌘ to select more or unselect)
[wpv-control-post-taxonomy taxonomy="entry_topic" type="multi-select" output="legacy" url_param="wpv-entry_topic"]
</div>
<div class="form-group search-languages">
<p>Languages (hold ctrl / ⌘ to select more or unselect)
[wpv-control-post-taxonomy taxonomy="entry_language" type="multi-select" output="legacy" url_param="wpv-entry_language"]
</div>
</div>
<div class="col-6">
<div class="form-group search-traditions">
<p>Traditions (hold ctrl / ⌘ to select more or unselect)
[wpv-control-post-taxonomy taxonomy="entry_tradition" type="multi-select" output="legacy" url_param="wpv-entry_tradition"]
</div>
<div class="form-group search-time">
<p>Times</p>
[double-range-filter]
<div class="search-time-input">
[wpv-control-postmeta class="time-filter-input" type="textfield" field="wpcf-entry-year2" url_param="wpv-wpcf-entry-year2" placeholder="From"]
<span class="search-time-between">-</span>
[wpv-control-postmeta class="time-filter-input" type="textfield" field="wpcf-year" url_param="wpv-wpcf-year" placeholder="To"]
<span class="search-time-between">or</span>
[wpv-control-postmeta values="-3000%%COMMA%%-800,-799%%COMMA%%-1,1%%COMMA%%799,800%%COMMA%%1499,1500%%COMMA%%1799,1800%%COMMA%%1929,1930%%COMMA%%1999,2000%%COMMA%%2024" display_values="3000 BCE – 800 BCE,799 BCE – 1 BCE,1 CE – 799 CE,800 CE – 1499 CE,1500 CE – 1799 CE,1800 CE – 1929 CE,1930 CE – 1999 CE,2000 CE – 2024 CE" field="wpcf-time-period" type="select" source="custom" default_label="Time Period" url_param="wpv-wpcf-time-period"]
</div>
</div>
</div>
</div>
<div class="search-checkboxes">
<div class="search-medium">
[wpml-string context="wpv-views"]<p>Medium:</p>[/wpml-string]
[wpv-control field="medium" url_param="medium" type="checkboxes" values=",1,2,3,4" display_values="Any,Book,Chapter,Article,Encyclopaedia"]
</div>

<div class="search-use">
[wpml-string context="wpv-views"]<p>Recommended use:</p>[/wpml-string]
[wpv-control field="use" url_param="use" type="checkboxes" values=",introductory,overview,further,specialised" display_values="Any,Introductory,Overview,Further,Specialised"]
</div>

<div class="search-difficulty">
[wpml-string context="wpv-views"]<p>Difficulty:</p>[/wpml-string]
[wpv-control field="difficulty" url_param="difficulty" type="checkboxes" values=",easy,intermediate,advanced" display_values="Any,Easy,Intermediate,Advanced"]
</div>
</div>
</dd>
</dl>
</div>
<div class="article-end"> </div>
<br>

[/wpv-filter-controls]
[wpv-filter-end]

#2785583

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

When I checked, you have added the frontend filters for Topic, Language and Tradition as multiselect filters.

By default, when you have multiselect filters, it will apply the OR for multiselect options.

Do you want to apply AND for multiselect options as well as for the multiple fields?

So do you mean irrespective of whatever filters and options selected you want to apply AND clause?

In addition to that - Could you please send me debug information that will help us to investigate your issue.
=> https://toolset.com/faq/provide-debug-information-faster-support/

#2785599

Hi Minesh, thanks for looking into it. The debug info is here.

Yes, that's correct, I'd like to apply an 'AND' function between all different filters, but 'OR' within the filters. So structure should be:
(filter 1 option A OR filter 1 option B ...) AND (f2 oA OR f2 oB ...) AND (f3 oA OR f3 oB ...) etc.

For example, user should be able to find only entries which are easy OR intermediate to read AND are books AND on the Topics of aesthetics OR epistemology, AND in the analytic Tradition, AND published in English OR French, AND within a specified timeframe.

#2785608

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

To check what filter clause is currently apply, can you please send me admin access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.