Skip Navigation

[Resolved] Filter in views

This support ticket is created 6 years, 4 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 6 years, 4 months ago.

Assisted by: Christian Cox.

Author
Posts
#1111473

Tell us what you are trying to do?
I have added some custom fileds to the Posts. Apart from others I have two custom fileds, one to note that one post is featured (to display it in a special place in the home page) and another post to note if this post should be or not displayed in the home page. Both these fields are "Checkbox".
I have created a view to created the featured posts that are allowed to be displayed in homepage and try to enter the query filter.
So what i need is to check that "Featured is true" and that "Allowed is also true"
How can i do this ?

Is there any documentation that you are following?
https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/

Is there a similar example that we can see?

What is the link to your site?

#1111718
Screen Shot 2018-09-19 at 3.03.40 PM.png
Screen Shot 2018-09-19 at 3.00.22 PM.png

Hi, it depends on whether or not you have other custom field filters applied to this View. If no other custom field filters are applied to this View, then you can create one Query Filter for checkbox 1 and another Query Filter for checkbox 2. Both of these checkboxes should be strings, equal to the Constant 1. Use the "AND" field relationship so the filter tests both values together. Your checkbox fields must store a value of "1", and must NOT save 0 to the database. See the screenshots.

If you cannot see the Query Filter section in the View editor screen, scroll to the top of the screen and click "Screen Options" in the top right corner. You can turn on the Query Filter display here.

If you have other custom field filters applied to this View, then all the fields will be considered together because you chose "AND". There isn't an easy way to use "AND" for some fields but use "OR" for other fields. It will require custom code.