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
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
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
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
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