Skip Navigation

[Resolved] search in category

This support ticket is created 2 years, 3 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 13:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Sao_Paulo (GMT-03:00)

This topic contains 4 replies, has 2 voices.

Last updated by michelL 2 years, 3 months ago.

Assisted by: Mateus Getulio.

Author
Posts
#2480721

My category field got 50 categories but I only want to show 5-10 (that I have selected) in the search bar.
Is this possible?

#2480947

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello there,

Thank you for contacting the Toolset support forum!

This will require some code customization, I’m afraid. Unfortunately, even if you add a static query filter for the taxonomy through the "Content Selection -> Query Filter" section, it would be overridden by the dynamic query applied by the front-end search field for that same taxonomy.

Therefore, to achieve what you're planning, you'll need to take care of two things:

1. You can hide the unwanted category term options from the front-end filter using custom CSS code, so that the user can't select them (it would be simpler if you use the select/drop-down type filter)

2. To dynamically apply a static query filter for the selected categories, only when a user has not selected it from the front-end. You can remove it from "Content Selection -> Query Filter" section and instead apply it through the "wpv_filter_query" filter:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

We have a relevant usage example for this, please check it out: https://toolset.com/forums/topic/custom-taxonomy-dynamically-choose-all-filter/#post-1617211

Please let me know if you need any further assistance around this. Thanks!

Regards,
Mateus.

#2482633

Okay great and can you tell me what CSS code I can use to hide the category 'Binnenplaats' and 'Drinkwater'

#2482685

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi there,

Thanks for your reply.

We can give it a try, but please bear in mind that custom code solutions are beyond the scope of this support forum, and generally what we recommend is that you check our contractors page: https://wpml.org/contractors/.

Could you please show us where in the website we can see those categories in a search box? We tried to search for them, but since the website is in Dutch, we weren’t able to find anything.

Please keep us posted. Thank you.

#2485119

My issue is resolved now. Thank you!