Skip Navigation

[Resolved] Display only parent taxonomy in Custom Search

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

Last updated by toolset-dave 5 years, 8 months ago.

Assisted by: Shane.

Author
Posts
#1189915

Hello,

I need to display only parent taxonomy in select

[wpv-control-post-taxonomy taxonomy="kategorie" type="select" default_label="bez omezení" url_param="wpv-kategorie" output="legacy"]

. See hidden link (you can find it in the third yellow underlined text). So I it should display only 6 main parent taxonomies and a default label. How to achieve that?

#1189946

Shane
Supporter

Languages: English (English )

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

Hi Dave,

Thank you for contacting our support forum.

Unfortunately this isn't possible to do as the field will pull all of the taxonomies regardless if they are parent or child .

Thanks,
Shane

#1189988

Hi Shane,

thanks for the reply. Isn´t it possible at least by hiding them by CSS or something similar? These child taxonomies will not be often updated.

#1190005

Shane
Supporter

Languages: English (English )

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

Hi Dave,

You should be able to do it with JS as you mentioned.

Add this to your js section of views.

jQuery(document).load(function () {
 jQuery(".resizeselect option[value='investicni-diamanty']").hide();
});

So what you need to do is to copy this section $(".resizeselect option[value='investicni-diamanty']").hide(); and change the value to match the value that each child option has and it will hide it from the select option.

Thanks,
Shane

#1190340

Hi Shane,

thanks for help. The code did nothing so I have made some attemps to make it working. And I found out that when I change .load to .ready it works nice. But the problem is when I want to see another page with results (manual transition with AJAX), the child taxonomy will appear again.

#1190474

Shane
Supporter

Languages: English (English )

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

Hi Dave,

What you need to do is to add this to the callback function for your view. Go to the JS editor under your frontend filters section.

Then click the Frontend Events button and then select the appropriate callback function then add your code within that callback function.

Thanks,
Shane

#1209666

My issue is resolved now. Thank you!