add_action( 'job_bm_job_edit_form', 'job_bm_job_edit_form_26072019', 15 ); if ( ! function_exists( 'job_bm_job_edit_form_26072019' ) ) { function job_bm_job_edit_form_26072019(){ ?> <pre>Content after job submission form</pre> <?php } }
Display custom input field
add_action( 'job_bm_job_edit_form', 'job_bm_job_edit_form_input_29072019', 5 ); if ( ! function_exists( 'job_bm_job_edit_form_input_29072019' ) ) { function job_bm_job_edit_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_edit_errors', 'job_bm_job_edit_errors_custom_field_29072019', 10,2); function job_bm_job_edit_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_edited', 'job_bm_job_edited_custom_field_29072019', 10,2); function job_bm_job_edited_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); }