Home › Toolset Professional Support › [Resolved] Parametric search: hide/exclude empty taxonomy terms in checkbox filters
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/Karachi (GMT+05:00)
Tagged: Custom search, Views, Views plugin
Related documentation:
This topic contains 2 replies, has 2 voices.
Last updated by Paul Marconi 1 year ago.
Assisted by: Waqar.
Hello,
I am using the 'Toolset Views' plugin to create a News landing page with a parametric search.
I have created a custom post types (News) with Toolset Types, and it has a couple of custom taxonomies (also created with Toolset Types):
- News Categories
- Practice Areas Categories
- Years
It's working fine, but I am trying to hide empty taxonomy terms from each of the checkbox filters.
It's currently listing all the terms from each custom taxonomy, even if no posts are tagged with those terms.
For example:
Under the 'Year Categories', there are 9 terms: 2015 to 2023
There are posts tagged with: 2023, 2022, 2021
so I want the 'Year Categories' checkbox filter to display those 3 terms/years (2023, 2022, 2021), the rest should be hidden.
Under 'Custom Search Settings' > 'Let me choose individual settings manually', selecting 'Show only available options for each input' sort of did the trick of hiding the empty terms, but it's not working how I want it.
When 'Show only available options for each input' option is set, and when I start to do the filtering on the front-end, other terms starts to disappear.
Example:
hidden link
If you select 'Aboriginal and Treaty Rights' under the 'Practice Areas Categories' filter, some terms from the other filters are disappearing, which I don't want, so choosing 'Show only available options for each input' is not going to work for me.
Is there a way to hide all empty terms, and have those terms to always shows after the view results are updated?
I have attached screenshot of my settings.
Thank you!
Hi,
Thank you for contacting us and I'd be happy to assist.
Your observation is correct and the "Show only available options for each input" option, works collectively with respect to all the fields in the search form. Its shows only those those options, which can produce some results. I'm afraid, it can't be made to work independently for each search field, individually.
One possible workaround can be to use some custom script, that can show or hide only the selected term's check-boxes. But that list will be manual and not automatic.
regards,
Waqar
Thank you Waqar! I do have a workaround for this.
Do you think the feature of hiding empty terms (terms with 0 posts) will be added in the future in the 'Toolset Views' plugin?
Another issue:
The parametric search has a text search filter that will search keywords from posts content and title (screenshot attached). It's working, but not working entirely.
Example:
A post has this word/text 'voices' on the title, and when I type in voices in the text search filter box, it doesn't display that post with the title that has the keyword 'voices'.
Another example: there is a post with the title "Blue Gold", and when I enter the term 'blue' in the search box, the "Blue Gold" post shows up, but when I enter in the term 'gold', that "Blue Gold" post doesn't show up in the results container.
What is the issue and can this be resolved?
thanks you!
I've found the issue. It's because the offset is set to 1 (skip first 1 item), so that's why it's not displaying the first post.