Please help in adding experience field
-
Hi Mike,
I have gone through some of the posts to know how to add the experience field to the job form in the form of a drop down. But as I am not a developer, I am unable get the coding done.
Request you to kindly help me with the coding so that I’ll be able to use the same.
Also, is there any option where I can contact you or PM you as I would like to purchase some of the addons.
-
I can look over your code and guide you, but I cannot write it for you ?? Show me what you’ve got.
Hi Mike,
Please find the code that I have written by editing the code for the salary field. I know it is wrong but as php knowledge is NIL I couldn’t write it exactly.
// For Jobs Section add_filter( 'submit_experience_form_fields', 'frontend_add_experience_field' ); function frontend_add_experience_field( $fields ) { $fields['experience']['job_experience'] = array( 'label' => __( 'experience', 'job_manage_experience' ), 'type' => 'dropdown', 'required' => true, 'placeholder' => '', 'priority' => 7 ); return $fields; } //add the field to admin add_filter( 'job_manager_experience_listing_data_fields', 'admin_add_experience_field' ); function admin_add_experience_field( $fields ) { $fields['job_experience'] = array( 'label' => __( 'experience', 'job_manage_experience' ), 'type' => 'dropdown', 'placeholder' => '', 'description' => '' ); return $fields; } // Display "experience" on single job page add_action( 'single_job_experience_meta_end', 'display_job_experience_data' ); function display_job_experience_data() { global $post; $experience = get_post_meta( $post->ID, '_job_experience', true ); if ( $experience ) { echo ' <li>' . __( 'Experience:' ) . ' ' . $experience . '</li> '; } }
For the ‘type’ use ‘select’ not ‘dropdown’.
Then pass in some options, e.g:
'options' => array( 'some' => 'Some', 'little' => 'little', 'none' => 'None', ),
Hi,
Should I use this in the “job section” and “add the field to admin”.
Also, I wish to purchase the application form addon. I have sent an message through the contact us page. Can you please look into it and help me with the purchase.
Both – the code is the same for both places.
Hi Mike,
As per your suggestion, have corrected the code. Please check and confirm so that I’ll use it in functions.php in my current themes folder.
// For Jobs Section add_filter( 'submit_experience_form_fields', 'frontend_add_experience_field' ); function frontend_add_experience_field( $fields ) { $fields['experience']['job_experience'] = array( 'label' => __( 'experience', 'job_manage_experience' ), 'type' => 'select', 'options' => array( 'fresher' => 'Fresher', '0 to 1 years' => '0 to 1 years', '1 to 2 years' => '1 to 2 years', '2 to 4 years' => '2 to 4 years', '4 to 6 years' => '4 to 6 years', '6 to 8 years' => '6 to 8 years', '8 to 10 years' => '8 to 10 years', '10 to 12 years' => '10 to 12 years', '12+ years' => '12+ years', 'none' => 'None', ), 'required' => true, 'placeholder' => '', 'priority' => 7 ); return $fields; } //add the field to admin add_filter( 'job_manager_experience_listing_data_fields', 'admin_add_experience_field' ); function admin_add_experience_field( $fields ) { $fields['job_experience'] = array( 'label' => __( 'experience', 'job_manage_experience' ), 'type' => 'select', 'options' => array( 'fresher' => 'Fresher', '0 to 1 years' => '0 to 1 years', '1 to 2 years' => '1 to 2 years', '2 to 4 years' => '2 to 4 years', '4 to 6 years' => '4 to 6 years', '6 to 8 years' => '6 to 8 years', '8 to 10 years' => '8 to 10 years', '10 to 12 years' => '10 to 12 years', '12+ years' => '12+ years', 'none' => 'None', ), 'placeholder' => '', 'description' => '' ); return $fields; } // Display "experience" on single job page add_action( 'single_job_experience_meta_end', 'display_job_experience_data' ); function display_job_experience_data() { global $post; $experience = get_post_meta( $post->ID, '_job_experience', true ); if ( $experience ) { echo ' <li>' . __( 'Experience:' ) . ' ' . $experience . '</li> '; } }
Seems ok
Hi,
I tried this code in functions.php from my dashboard. After updating the sheet there was no change in the job posting page.
Please suggest
submit_experience_form_fields filter name is wrong actually. submit_job_form_fields is correct.
The correct code is as mentioned below. I tried it and it’s working fine. Hope this code could be helpful to someone else who is looking for adding experience in the job posting form.
//To add salary in job posting page add_filter( 'submit_job_form_fields', 'frontend_add_experience_field' ); function frontend_add_experience_field( $fields ) { $fields['job']['job_experience'] = array( 'label' => __( 'Experience', 'job_manager' ), 'type' => 'select', 'options' => array( 'fresher' => 'Fresher', '0 to 1 years' => '0 to 1 years', '1 to 2 years' => '1 to 2 years', '2 to 4 years' => '2 to 4 years', '4 to 6 years' => '4 to 6 years', '6 to 8 years' => '6 to 8 years', '8 to 10 years' => '8 to 10 years', '10 to 12 years' => '10 to 12 years', '12+ years' => '12+ years', ), 'required' => true, 'placeholder' => '', 'priority' => 8 ); return $fields; //add the field to admin add_filter( 'job_manager_job_listing_data_fields', 'admin_add_experience_field' ); function admin_add_experience_field( $fields ) { $fields['job_experience'] = array( 'label' => __( 'experience', 'job_manage_experience' ), 'type' => 'select', 'options' => array( 'fresher' => 'Fresher', '0 to 1 years' => '0 to 1 years', '1 to 2 years' => '1 to 2 years', '2 to 4 years' => '2 to 4 years', '4 to 6 years' => '4 to 6 years', '6 to 8 years' => '6 to 8 years', '8 to 10 years' => '8 to 10 years', '10 to 12 years' => '10 to 12 years', '12+ years' => '12+ years', 'none' => 'None', ), 'placeholder' => '', 'description' => '' ); return $fields; } } // Display "experience" on single job page add_action( 'single_job_listing_meta_end', 'display_job_experience_data' ); function display_job_experience_data() { global $post; $experience = get_post_meta( $post->ID, '_job_experience', true ); if ( $experience ) { echo ' <li>' . __( 'Experience:' ) . ' ' . $experience . '</li> '; } }
Request you to also help me on how to add this in the search form. So that when a user searches for the jobs using the keywords, location, category and experience. Relevant jobs will be shown.
Keyword search will pick up the value. We don’t have a tutorial for adding new filters/search inputs.
- The topic ‘Please help in adding experience field’ is closed to new replies.