Home › Toolset Professional Support › [Resolved] Unable to hide post in view using checkbox
Problem:
I want to hide some of many posts displayed in a Toolset View.
How can I do this easily, so I do only need to update those Posts I do not want to display (because these are the less in number), instead of updating ALL posts with a Show/No Show value?
Solution:
The easiest is to use a Taxonomy.
Tag the Posts you want to hide with a "no show" tag and leave the Posts you want to show or simply make sure they do not have that tag (which will be the default).
Then create a View and query the posts by Terms "no one of these {your no show term}"
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.
Our next available supporter will start replying to tickets in about 5.57 hours from now. Thank you for your understanding.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | - | 14:00 – 20:00 | 14:00 – 20:00 | 14:00 – 20:00 | 14:00 – 20:00 | 14:00 – 20:00 |
- | - | - | - | - | - | - |
Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)
Tagged: How to build a site with Toolset
This topic contains 6 replies, has 2 voices.
Last updated by Chris 4 years, 8 months ago.
Assisted by: Beda.
I have a view that filters custom posts by distance. I also want to hide some posts so they do not appear and want to do this using a simple checkbox custom field. When I add the checkbox I can limit the display so that those that are checked are the only ones that appear by choosing "equal to the constant 1" but when I change that to "different from the constant 1" no posts at all display. I want to NOT display those that are checked. See screenshots - the settings shown are hiding ALL posts.
What am I getting wrong here?
Many thanks
Yes, that's expected
You will only have posts with either 1 saved, or nothing saved, as your checkbox settings state
So querying by nothing (different than one) will return nothing.
It is not suggested to use "save 0" in the checkbox, so that would not be a solution either
The only solution is to query the view by posts where the value is 1
That is the right approach to the solution
Ok thank you for the clarification.
Without adding values for every post how can I selectively hide just a few posts - clearly I had it wrong. Is there an easier way to do this? I can use any field type if there is a better way.
Many thanks
My issue is resolved now. Thank you.
Decided just to exclude on post id for now. Will suffice the time being.
the problem with the Query filter by such a checkbox is, it only offers to filter posts with a value in that field, and then compares that values to anything you set.
It does not allow to filter by non-existing values.
Hence as mentioned the setting "save 0 when not checked", which was intended to solve exactly that issue, giving value to the field you can successfully filter out, by default.
But, this will not help any more, unfortunately: https://toolset.com/errata/checkboxes-that-save-0-are-interpreted-as-checked-by-views/
Hence, the only solution with a Custom Field is to actually save values for all posts that you want to display, instead of saving values for posts you do not want to display.
Or, you can use a Taxonomy.
You can create a Term "Not Show", for example, and tag all the posts you do not want to show, with that term
Then, in your View, you can remove all posts with that Tag using a Query Filter for the taxonomy term "no one of these".
Does this help to reach your goal?
Changing the status of this ticket. See my last reply above for actual valuable information, this message here can be ignored.
Many thanks - that is helpful. I'll use the taxonomy approach if necesary.