Skip Navigation

[Resolved] Filter search with taxonomy conditional

This support ticket is created 6 years 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 3 replies, has 2 voices.

Last updated by Akhil 6 years ago.

Assisted by: Nigel.

Author
Posts
#1142484

Hi Nigel.welcome back!

The shortcode that you gave is not working in the custom search area.

[wpv-conditional if="('[taxonomy ='taxonomy' ]' eq 'Eat & Drink' )" debug="true"]
eat drink
[/wpv-conditional]

the debug value is valid but there is no output .

all i need is to hide certain filters [enclosed with a style div] depending of the taxonomy url .

Pls guide. Thank You !

#1142502

i tested with simple scripts. its seems to be working just to confirm i am doing the right thing and performance wont be an issue

(function($) {
    $(document).ready(function() {
 
        $('.filter-fnb').hide();
        $('.filter-kids').hide();
 
       if(window.location.href.indexOf("eat-and-drink") > -1) {
       $('.filter-fnb').show();
       $('.filter-kids').show(); 
        }
      if(window.location.href.indexOf("automotives") > -1) {
       $('.filter-fnb').hide();
       $('.filter-kids').show();
        }
           
    });
})(jQuery);

#1143006

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Dee

I don't see any particular issue with your JS code (assuming it doesn't create any visual glitch as the page loads).

In your initial post you showed using a wpv-conditional shortcode.

You can use the custom taxonomy shortcode I provided as a condition (provided you registered it at Toolset > Settings > Front-end Content), but you need to use the shortcode correctly.

Here is a reminder of some of the ways you can use it:

[taxonomy output='taxonomy'] -- outputs the taxonomy slug
[taxonomy] -- outputs the term name (default)
[taxonomy output='count'] -- outputs the count of results
[taxonomy output='field' field='wpcf-colour'] -- outputs a 'colour' taxonomy custom field

It looks like you want to output the term name, which means you can use just [taxonomy], or you might find the slug a safer option ([taxonomy output='slug']).

#1143019

My issue is resolved now. Thank you very much Nigel !