Skip Navigation

[Resolved] Filter by a range between 2 values (minimum & maximum)

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

Problem:
Posts have a Types number field, and a custom search View should be able to filter posts where the user specifies min and max values for the field.

Solution:
When inserting a Filter Control for the field, using the UI you can select the between comparison which will open up options for comparison type (e.g. compare as number), where the labels for the min and max controls can be specified (see screenshot in answer below).

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

This support ticket is created 6 years, 6 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
- 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)

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 6 years, 6 months ago.

Assisted by: Nigel.

Author
Posts
#914975

Tell us what you are trying to do? Inserting 2 fields for filtering a numeric field (Size attribute for a property) that filter between a minimun and a maximun value.

Is there any documentation that you are following? https://toolset.com/documentation/user-guides/front-page-filters/#vfmh-styling-your-filter ** Note the range filter SQ FT FROM / SQ FT TO and PRICE MIN / PRICE MAX

Is there a similar example that we can see? https://toolset.com/documentation/user-guides/front-page-filters/#vfmh-styling-your-filter ** Note the range filter SQ FT FROM / SQ FT TO and PRICE MIN / PRICE MAX

What is the link to your site? hidden link

ANy idea?

#915135

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screen Shot 2018-06-19 at 09.41.45.png

Have you tried and it doesn't work or you are not sure how to do it?

Assuming you have a custom field of size and another of price then in your View you insert custom filter controls for each of these, much like you have already with the Tipo de Operación and Submercado filters.

You would choose the between comparison in the dialog box and probably numeric, and you would need to set the labels for from and to, as shown in the screenshot.

That would insert markup and shortcodes something like this into your Search and Pagination section:

<div class="form-group">
	<label>[wpml-string context="wpv-views"]Price from[/wpml-string]</label>
	[wpv-control-postmeta field="wpcf-price" url_param="wpv-wpcf-price_min"]
</div>
<div class="form-group">
	<label>[wpml-string context="wpv-views"]Price to[/wpml-string]</label>
	[wpv-control-postmeta field="wpcf-price" url_param="wpv-wpcf-price_max"]
</div>

Yours will differ slightly depending on the custom field slug and the labels you chose.

You can do this for both the size and price fields.