Skip Navigation

[Resuelto] limit search to selected terms in taxonomy

This support ticket is created hace 5 años, 10 meses. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

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)

Este tema contiene 2 respuestas, tiene 2 mensajes.

Última actualización por Ido Angel hace 5 años, 10 meses.

Asistido por: Nigel.

Autor
Mensajes
#1185769

hey,
i want to create "basic" and "advanced" search options on my site.
I have a taxonomy of "know-as" (writer, editor, researcher etc), which includes about 40 terms in it.
in the "basic" search, I want the user to be able to search only between 5 or 6 of these terms.
in the "advanced" search - all terms will be available.
i tried changing in the filter section to "any of the following" and chose the terms i wanted, but i think this only controls the results and not the search - because the search still shows me all terms.
btw - i have a code to allow users to change "any/all/none" within the search - and i want to keep it. got it with the kind help of Waqar here: https://toolset.com/forums/topic/allow-frontend-user-to-change-any-to-all-closed-by-mistake/
thanks!

#1185894

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Hi Ido

Views doesn't offer any way of customising the filter controls added to a custom search, beyond what you can set in the GUI when inserting the filter.

There are no PHP filters, for example, that can be used to modify which terms are included in a taxonomy filter.

So if you want to show only a handful of a total of 40 terms then the only way to do so would be to use JavaScript to hide those you didn't want displayed.

And if you mean for users to be able to toggle whether they want to be able to choose from all terms rather than the sub-set of terms, you'd need to add a button to the search form and add a click event handler to that to toggle the visibility.

It's not really something that falls within the scope of support, as it means writing custom code to implement this.

You'll need to use the browser tools to examine the markup for the filter controls so that you can manually construct a jQuery selector for the 'basic' terms, which you can use to infer the advanced terms inputs, which you can then hide and set up the visibility toggle with.

#1185895

Ok, Nigel - got it. thanks!