Skip Navigation

[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)

This topic contains 2 replies, has 2 voices.

Last updated by Paul Marconi 3 months, 2 weeks ago.

Assisted by: Waqar.

Author
Posts
#2677313
filter-settings-filter-options.png
filter-settings-display-options.png
03-Custom Search Settings.png
02-Pagination and Sliders Settings.png
01-view-query-filter.png

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!

#2677520

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

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

#2677583
Screenshot 2024-01-08 094117.png

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!

#2677589

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.

Paul Marconi confirmed that the issue was resolved on 2024-01-08 16:11:57.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.