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?
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).
Thank you, I will see into this with a developer then 🙂 At least I know where to start now.