Skip Navigation

[Resolved] wpv-filter-reset cosmetic changes

This support ticket is created 3 years, 11 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 2 replies, has 2 voices.

Last updated by kemalS-2 3 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#2094467

Hi, I am developing my own theme in combination with Toolset to handle dynamic content.

I have noticed that the filters used with wpv-category and wpv-post_tag remove the default label on reset while filters that use custom fields keep their default label even on clearing the filters.

hidden link <- GIF of my issue.

the side hustles view: https://pastebin.com/Sj3GCxp6 <- uses custom fields to filter

the blog view: https://pastebin.com/xajRB261 <- uses taxonomy to filter

I have already tried using both filters together and yes if you do that one filter will keep the default label and the other won't, this looks weird so I am asking is there a way to either make both of them keep their default labels on reset or both have an empty field while disabled?

#2094977
Screen Shot 2021-06-21 at 4.15.16 PM.png
Screen Shot 2021-06-21 at 4.11.54 PM.png

Hi, if I understand the problem correctly, you're saying that the default label for a taxonomy filter remains visible during the reset process while the default label for a custom field filter is not displayed during the reset process. Am I understanding correctly? If so, the difference here is a technical one that does not have a simple solution. The difference is that a taxonomy filter's default option has a value of "0", but the default option for a custom field filter has no value (screenshot here showing this in the markup of the browser inspector). When a select field with no value in the default option is disabled, no default label is displayed. However, if the default option has a value of 0, the default option label is displayed. That seems to be a product of how HTML is rendered in the browser, and the fact that the default options have different values. I guess you could try a custom JavaScript solution that manipulates those values somehow, but I'm not sure how those value manipulations would impact search results as filter customizations like this are bit outside the scope of support offered here in the forums. There is no public API for Views filter manipulation, but there are some event hooks you can tap into to trigger your own custom code. You can find scaffolding for those events in the Frontend Events button in the JS editor of the Search and Pagination editor panel (screenshot attached here showing the button location in the View editor screen).

#2095041

Thank you, I will see into this with a developer then 🙂 At least I know where to start now.