Skip Navigation

[Closed] Use date custom field in parametric search form to filter "years of experience?"

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

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by Bigul 9 years, 3 months ago.

Assigned support staff: Bigul.

Author
Posts
#178731

I've got a custom post type set up that includes a date custom field, used by people to set the date they started in a given role.

I've got a parametric search form set up that filters by a number of criteria and I'm trying to figure out how to create a filter that would use the date custom field to allow people to search for people with X years of experience in a particular role.

So it would be possible, based on the start date set, for people to search for people by years of experience in that role - e.g.,

Min 1 year
Min 2 years
Min 3 years
10 or more years

Or perhaps even a range - e.g.,

Min 1 - 3 years
Min 3 - 5 years
Min 5 - 10 years

I've been playing around with various different filters for the date field and can't seem to come up with something that works.

Please advise.

Thanks,

Dawson

#179185

Bigul
Supporter

Dear Dawson,

Just for a confirmation, Search form will have a drop down box with following options, based on that selection we need to search and list the Peoples on the basis of date of join custom field value. Am I right ?

Min 1 year
Min 2 years
Min 3 years
10 or more years

--
With Regards

Bigul

#179291

Hi Bigul

The search form has four different fields/criteria at present. I'd like to add one that, in effect, uses the current year as the reference point against a date from a custom field, added using the date picker.

So suppose person A set the date in their profile to June 6, 2005; person B to September 11, 1991; and person C to January 5, 2011.

I'd like people to be able to use a dropdown on a search form that specifies years of experience - e.g., as you have indicated:

Min 1 year
Min 2 years
Min 3 years
10 or more years

A variation on that - such as a range - night actually be better - e.g.,:

0 - 3 years
3 - 5 years
5 - 10 years
10 years +

So if someone selected 3 - 5, they'd get person C. If they selected 5 - 10 years, they'd get person A. If they selected 10 years +, they'd get person B.

So basically, I need to try to figure out how to create some parameters that essentially subtract the year set with the datepicker from the current year.

I played around with different filters but could not get things sorted.

Cheers

Dawson

#179954

Bigul
Supporter

Dear Dawson,

I will discuss the requirement with our lead developer and get back to you. He is on leave now, so may it will take two-three days. Please wait.

--
With Regards

Bigul

#180192

Sounds good!

Cheers

Dawson

#180255

Bigul
Supporter

Dear Dawson,

It can be done, but it will require some custom coding.

Basically, you will need to remove the wpv-control shortcode and create the select dropdown by hand, and then based on the values set up that dropdown in Filter section of view. Then add a filter in the wpv_filter_custom_field_filter_processed_value hook. Please check this example: https://toolset.com/documentation/user-guides/views-filters/wpv_filter_custom_field_filter_processed_value/


With Regards

Bigul

The topic ‘[Closed] Use date custom field in parametric search form to filter "years of experience?"’ is closed to new replies.