Skip Navigation

[Resolved] conditional output

This support ticket is created 3 years, 6 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 – 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: Africa/Casablanca (GMT+01:00)

This topic contains 2 replies, has 2 voices.

Last updated by jenW 3 years, 6 months ago.

Assisted by: Jamal.

Author
Posts
#2064373

I have a filter set up ... and I need it not to show a filter if there are no taxonomy items. the filter is based off of a taxonomy.

current filter :

<div class="nav_fil_box">
<label for="wpv-release-quarter">[wpml-string context="wpv-views"]<h3 class="rm_fil_title">Filter by Discovery Roadmap</h3>[/wpml-string]</label>
<div class="form-group rm_nav_group">
[wpv-control-post-taxonomy taxonomy="release-quarter" type="checkboxes" format="%%NAME%%" url_param="wpv-release-quarter"]
</div>
</div>

** i need the above not to show up if taxonomy="release-quarter" has no post items associated with it. This is so there is not just a blank box.

is this possible?

I tried using conditional statements .. but had no luck..

#2065101

Hello and thank you for contacting the Toolset support.

Unfortunately, Toolset views do not have a way to tell if a taxonomy filter has any values. The only way, I can think of it, is by using custom Javascript code. You can add a custom Javascript code that will check if the filter has any values, if it does not, it can hide it.

If the view is using AJAX, you will need to listen to the views' events to trigger the custom code. Check this article about views' events in this article:
https://toolset.com/documentation/programmer-reference/adding-custom-javascript-code-to-views-that-use-ajax/

I hope this helps. Let me know if you have any questions.

#2067757

My issue is resolved now. Thank you!