Skip Navigation

[Resolved] Force a field to be a value in parametric search.

This support ticket is created 7 years, 10 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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)

This topic contains 2 replies, has 2 voices.

Last updated by jamesH-10 7 years, 10 months ago.

Assisted by: Beda.

Author
Posts
#402368

I am trying to: I have a parametric search for CPTs but I want to be able to force on value and hide the field ( I am sure I can do this easy with CSS ).

So I have created separate pages for each state within Australia i.e. New South Wales, Victoria etc. and each page has a parametric search which works perfectly. The trick is to be able to a field set to a particular state and to exclude all values returned that are not in that state.

I can set a default value for that field but it only updates the search results ( and successfully omits all other states ) when I change the value to a different state. Is there someway that I can force this to happen without the need for the value to be set in the form?

Plan B: I can filter the results with a conditional statement in the Loop Output just after the <wpv-loop>:

[wpv-conditional if="( $(wpcf-state) eq 'Western Australia' )"]

This works but I am concerned how this would effect the efficiency of the query. The parametric search would effectuively be getting all results from across Australia and only the Loop Output will be refining it down to the relevant state.

I hope that all makes sense.

Many thanks,
Chris

#402488

I apologise, I do not understand correctly.

Are you trying to create a Parametric Search that shows the User only options (for the parameters) present in the Posts returned by a previous search?

It can be done in the GUI Settings for your Parametric Search Filters and also in the Parametric Search Settings > Let me choose individual settings manually > Which options to display in the form inputs

If you want to pass a Hidden Filter, you do not need the Parametric Search but could use the Query Filer instead.

Or, you can hide the Filter (Parametric Search) by passing [wpv-filter-start hide="true"] in the Filter section.

This is related Documetnation:
https://toolset.com/documentation/user-guides/front-page-filters/
https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/

#402943

Thanks for the reply Beda. I have taken another approach here that may work but I have another issue. I will create another thread to keep it clean.

Thanks,
Chris

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.