Skip Navigation

[Résolu] Create a custom search by fields

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:
How can I create a Custom Search with Views for my posts (cars) so the users can find their make and model?

Solution:
1. Create your Posts (cars)
2. Add a Custom Field (select, perhaps) for the make
3. Add a Custom Field (select, perhaps) for the model

Those Custom Fields should be pre-populated.

Then, update your cars with that information.

After, create a View, add 2 Custom Filters by the Make and Model Field, and choose "Let me choose individual settings manually" in the "Custom Search Settings".
There, choose "Show only available options for each input".

Relevant Documentation:
https://toolset.com/documentation/user-guides/front-page-filters/

This support ticket is created Il y a 7 années et 3 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Auteur
Publications
#561307

Hi,

I tried out 'one to many' post types relationship and hierarchical taxonomies but that is not really what I want to achieve.

I have a post type called "cars" and within this post type I have a field named "Make" and another one named "Model". "Model" should be a child of "Make" so that I can set up a filter like you can see here: lien caché. The values of the "Model" dropdown are conditioned by the selected value in the "Make" dropdown.

How can I achieve this?

Thanks.

#561477

You do not really need a parent/child relation.

1. Create your Posts (cars)
2. Add a Custom Field (select, perhaps) for the make
3. Add a Custom Field (select, perhaps) for the model

Those Custom Fields should be pre-populated.

Then, update your cars with that information.

After, create a View, add 2 Custom Filters by the Make and Model Field, and choose "Let me choose individual settings manually" in the "Custom Search Settings".
There, choose "Show only available options for each input".

That will make exactly what you want.

If you want to be able to populate Make and Model while editing the Car post, you might also use a Single Line Field, which you can still use as a Select Field in the Custom Search.

#562045

Hi Beda,

That worked fine.

Thanks.