Skip Navigation

[Resolved] Multiple Query Filters for one View – AND OR NESTED CONDITIONAL

This support ticket is created 2 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 2 years, 2 months ago.

Assisted by: Luo Yang.

Author
Posts
#2486769

Tell us what you are trying to do?

Hi I would need to be able to have two/three different filters for one view that all apply:

One filter is Posts with taxonomy Countries and slug "Community"

or

Second filter is Posts with taxonomy Countries and slug "National" and Custom Field Rank = "2"

or

Second filter is Posts with taxonomy Countries and slug "Global" and Custom Field Rank = "3"

Thanks

#2487379

Hello,

There isn't such kind of built-in feature within Toolset plugins, you might consider custom codes, for example:
1) Setup a post view:
- Query posts
- In view's loop, display post information

2) Use filter hook "wpv-filter-query" to trigger a custom PHP function:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

3) In this PHP function:
Get below post IDs three times:
- Get all posts IDs which are with taxonomy Countries and slug "Community"
https://developer.wordpress.org/reference/classes/wp_query/
- Get all posts IDs which are with taxonomy Countries and slug "National" and Custom Field Rank = "2"
- Get all posts IDs which are with taxonomy Countries and slug "Global" and Custom Field Rank = "3"
Merge above IDs into a PHP array, and pass it as View's query paramter "post__in":
https://developer.wordpress.org/reference/classes/wp_query/#post-page-parameters
post__in (array) – use post ids. Specify posts to retrieve.

For your reference.