Skip Navigation

[Resolved] Question about creating a custom search / filter

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

Problem:

Is there a way to set the default value in the select menu to "All" and have that be an option in the select menu?

Solution:

Edit your view, in section "Search and Pagination", find the shortcode of [wpv-control-postmeta ...] for field "Price Range", add an attribute default_label="All" in it, for example:

[wpv-control-postmeta ... default_label="All"]

Relevant Documentation:

https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-control-postmeta

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

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by josephC-5 5 years, 2 months ago.

Assisted by: Luo Yang.

Author
Posts
#1366941

Hi there,

I've created a custom search / filter based on a custom field. The custom field, called Price Range, has three values: High, Medium, and Low.

I've set up the custom search / filter to update via this option: "AJAX results update when visitors change any filter values." The three values are displayed in a select / pull-down menu:
—High
—Medium
—Low

Right now, the filter shows the first item, "High," as the default value, which is misleading (because posts matching all three values appear by default). And it means that a user has to change the menu to "Medium" or "Low," and then back to "High," to see the posts which have a custom field value of "High."

Here's my question: is there a way to set the default value in the select menu to "All" and have that be an option in the select menu? Here's what I'm trying to accomplish:
—All
—High
—Medium
—Low

Thank you!

Saul

#1367101

Hello,

I suggest you try these:
Edit your view, in section "Search and Pagination", find the shortcode of [wpv-control-postmeta ...] for field "Price Range", add an attribute default_label="All" in it, for example:
[wpv-control-postmeta ... default_label="All"]

And test again

More help:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-control-postmeta

#1367687

This is exactly what I was looking for. Thank you, Luo!

Saul