Skip Navigation

[Resolved] Hide labels and options if not available

This support ticket is created 5 years, 4 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 7 replies, has 3 voices.

Last updated by catrionaD 5 years, 4 months ago.

Assisted by: Shane.

Author
Posts
#1288621

Tell us what you are trying to do?

1) Hide filter labels if none of the results have a taxonomy option selected for that label.

2) Hide taxonomy options if none of the results have a corresponding option ticked. For example, if no posts have selected the "Polish" language option, then this should not be a visible option to users. (Alternatively greyed out options would work too)

Is there any documentation that you are following?
No, I have searched the forum and have selected the "Show only available options for each input" but this doesn't seem to work.

Is there a similar example that we can see? No

What is the link to your site? hidden link

#1288791

Hi, you mentioned that "Show only available options for each input" isn't working as expected. It looks like you have a View split up into filters and results using separate shortcodes or separate Elementor widgets. If you place the View in a draft page and display the filters and results together using a single shortcode or a single Elementor widget, is the "Show only available options" feature working more like you would expect? I've seen some strange things happen with split Views in Elementor and I'm curious to know if this is another of those situations.

#1288927

I tried two tests.
hidden link
hidden link

Before I search for "diabetes" as an example, all of the options are shown, whether available or not.
Once I search for "diabetes" I think it is only available options that are shown. However, the labels still show where there might not be any filter options available - I would like to hide these.

So for filter options - I now realise that a text search first needs to take place.
For labels, how can I hide these please?

Thanks

#1288945

Let me make sure I understand what you want to hide, there are a few things that could be considered labels here. In this example: hidden link

Are you referring to the HTML label elements like "Tick if they apply" in the Personalize section of filters, or something else?

#1290619

Where there is a label used as a heading for tickboxes or radio buttons, I would like that label removed. For example, if there were no options available under "Type" or "Cost" then those labels are hidden.

For the dropdowns without labels for headings, it would be good to hide the drop-down element. For example, the "- Select age" dropdown would be hidden if there are no options available.

Is this possible?

#1291815

Hi Christian,

I am now working with two views; one for desktop/tablet "NL Search Desktop" and one for mobile "NL Search Mobile".

Card headers "Service," "Tailored support" and "Provider" should always be visible.

Under these Card headers, in both views I would like to hide all:

1. Dropdown filters, when there are no filter options available (keeping any title above the dropdown filters). An example of this is taxonomy="support-type" with default_label "- Select type".

2. Radio title labels where there are no options available. An example of this is: <label class="filterlabelb">[wpml-string context="wpv-views"]Cost[/wpml-string]</label>

3. Checkboxes title label where there are no options available. An example of this is: <label label class="filterlabelb">[wpml-string context="wpv-views"]Does not require...[/wpml-string]</label>

Any guidance or help you can provide would be great, I had a search and couldn't find a way to do this!

Thanks,
Cat

#1292893

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Catriona,

As Christian had mentioned this is the option to hide the items that will return no results.

However you are referring to hiding the label as well correct?

If so then its not possible unless you use some custom code to achieve, like javascript to hide it if some options are not available.

Thanks,
shane

#1297737

My issue is resolved now. Thank you!