Skip Navigation

[Resolved] Searching by age

This support ticket is created 6 years, 1 month 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 3 replies, has 2 voices.

Last updated by davidZ 6 years ago.

Assisted by: Minesh.

Author
Posts
#1121030

I'm trying to figure out if it's possible to filter by an age. If my content has two fields: min_age and max_age, is it possible to return results where the submitted number is between those two values?

For instance, if I have a post where the age range is 18-25, and someone filters with an age of 20, this post would be included, but if they submit 30, it would be excluded.

Thanks

#1121578

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Yes - you can add range filter using views and filter your posts.

Well - you should add the range filter. Please check here.
=> hidden link

You will see price and Bedrooms fitlers with min and max value. To know how it used to setup, please feel free to create a test site using "Real Estate" reference site on our test platform discover-wp.com.
=> https://toolset.com/faq/how-and-why-to-create-a-test-site-in-discover-wp/

#1121731

Thanks for the sample. But this is actually the reverse of what I'm hoping to do.

My post would have minimum and maximum age fields.

The user would filter by their age.

Is there a way to filter like:

min_age =< [submitted value] =< max_age

Thanks

#1122629

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - so basically you have two custom fields that stores min and max age respectively. So, yes I think its easy, you need to add query filters for both of your filters.

You should add both of your filters and make sure query filters are added for both custom fields.
=> https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/

If you still do not know how to do it, please feel free to get in touch with me with problem URL and access details.

I have set the next reply to private which means only you and I have access to it.