Content inside job submission from.
add_action( 'job_bm_job_submit_form', 'job_bm_job_submit_form_26072019', 15 ); if ( ! function_exists( 'job_bm_job_submit_form_26072019' ) ) { function job_bm_job_submit_form_26072019(){ ?> <pre>Content job submission form</pre> <?php } }
Display custom input field
add_action( 'job_bm_job_submit_form', 'job_bm_job_submit_form_input_29072019', 5 ); if ( ! function_exists( 'job_bm_job_submit_form_input_29072019' ) ) { function job_bm_job_submit_form_input_29072019($job_id){ ?> <div class="form-field-wrap"> <div class="field-title">Custom field</div> <div class="field-input"> <input placeholder="custom placeholder" type="text" value="" name="custom_field_id"> <p class="field-details">Custom field details</p> </div> </div> <?php } }
Validate custom field data
add_filter('job_bm_job_submit_errors', 'job_bm_job_submit_errors_custom_field_29072019', 10,2); function job_bm_job_submit_errors_custom_field_29072019($error, $form_data){ if(empty($form_data['custom_field_id'])){ $error->add( 'custom_field_id', __( '<strong>ERROR</strong>: custom field is empty.', 'job-board-manager' ) ); } return $error; }
Save data
add_filter('job_bm_job_submitted', 'job_bm_job_submitted_custom_field_29072019', 10,2); function job_bm_job_submitted_custom_field_29072019($job_ID, $form_data){ $custom_field_id = isset($post_data['custom_field_id']) ? sanitize_text_field($form_data['custom_field_id']) : ""; update_post_meta($job_ID, 'custom_field_id', $custom_field_id); }
Remove existing input fields
You can remove existing input fields via remove_action hook for each hooked function. here is the example code to remove “Salary Type” input field
function remove_job_board_job_submit_input_actions(){ remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_salary_type', 30); } add_action('job_bm_job_submit_form','remove_job_board_job_submit_input_actions', 2);
Default hooked function for job_bm_job_submit_form
add_action('job_bm_job_submit_form','remove_job_board_job_submit_input_actions', 2); function remove_job_board_job_submit_input_actions(){ remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_title', 5); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_content', 10); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_categories', 20); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_job_info_title', 30); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_total_vacancies', 30); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_job_type', 30); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_job_level', 30); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_years_experience', 30); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_salary_type', 30); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_salary_fixed', 30); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_salary_min', 30); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_salary_max', 30); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_salary_currency', 30); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_contact_email', 30); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_company_info', 40); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_company_name', 45); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_company_name', 45); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_location', 45); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_address', 45); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_company_website', 45); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_company_logo', 45); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_recaptcha', 45); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_nonce', 45); remove_action('job_bm_job_submit_form', 'job_bm_job_submit_form_submit', 90); }
Then simply add your code by your custom code for removed fields
add_action('job_bm_job_submit_form', 'job_bm_job_submit_form_company_name_13042022', 45); function job_bm_job_submit_form_company_name_13042022() { $job_bm_location = isset($_POST['job_bm_location']) ? sanitize_text_field($_POST['job_bm_location']) : ""; ?> <div class="form-field-wrap is_required"> <div class="field-title"><?php _e('Location custom label', 'job-board-manager'); ?></div> <div class="field-input"> <input placeholder="New York" type="text" value="<?php echo esc_attr($job_bm_location); ?>" name="job_bm_location"> <p class="field-details"><?php _e('Custom field details', 'job-board-manager'); ?></p> </div> </div> <?php }