Skip Navigation

[Resolved] Create a custom search by fields

This thread is resolved. Here is a description of the problem and solution.

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 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.

Author
Posts
#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: hidden link. 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.