Thread Starter
j_mo
(@j_mo)
Thanks for this.
I have actually added the salary field to my build already but what I want to do next seems more difficult.
I suppose what I want to know is firstly: How can I add a select drop down instead of an input to the admin and front end, then add it to the jobs filter search?
After that, I would like to remove the current ‘all locations’ input from the admin, frontend and jobs filter.
Thanks
If you don’t mind me asking, how did you add the salary field?
Sorry I missed the link from tinygiantstudios above.
@j_mo that page with the snippet can be used for dropdowns too. Set your new fields ‘type’ to select, and define an array of options:
'sample_field' => array(
'label' => 'Your Field',
'type' => 'select',
'required' => true,
'options' => array(
'option-1' => 'Option 1',
'option-2' => 'Option 2'
),
)
Thread Starter
j_mo
(@j_mo)
Perfect. Got that in the admin now. Thanks.
My next question, which I think is going to be the hard part is how can I get that field into the job filter. e.g. How can I make it searchable?
I would need option 1 and option 2 to be searchable but another option ‘All options’ to search all other options in the select.
Thanks in advance.
Correct thats the hard part.
To add your field you can either override the template, or hook in a custom function. I use a custom function in my tags plugin:
add_action( 'job_manager_job_filters_search_jobs_end', array( $this, 'show_tag_filter' ) );
show_tag_filter is my method I output the tags/fields.
Then to actually use your data to filter, you’ll need to hook in another function. Again with my tags plugin I use this hook:
add_filter( 'job_manager_get_listings', array( $this, 'apply_tag_filter' ) );
Getting your new fields data would be something like this:
$params = array();
if ( isset( $_POST['form_data'] ) ) {
parse_str( $_POST['form_data'], $params );
if ( isset( $params['job_tag'] ) ) {
In the above, my new field for filtering was named ‘job_tag’. Once I’ve got that value, I can manipulate the query passed by the job_manager_get_listings filter.
Sorry to re-open this thread.
I’ve added the salary field and it shows in the admin area. But where do I go to adjust the template to show this new field?
I want to adjust the main jobs page and the actual job page.
Cheers
Moderator
Jan Dembowski
(@jdembowski)
Forum Moderator and Brute Squad
Sorry to re-open this thread.
Don’t be sorry but instead please start your own topic.
http://wordpress.org/support/plugin/wp-job-manager#postform
This one is marked resolved already.