Skip to content

Instantly share code, notes, and snippets.

@mikejolley
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikejolley/70587a1f89c12c3540d4 to your computer and use it in GitHub Desktop.
Save mikejolley/70587a1f89c12c3540d4 to your computer and use it in GitHub Desktop.
Job Applications - Form customisation
// Add a new field
add_filter( 'job_application_form_fields', 'custom_job_application_form_fields' );
function custom_job_application_form_fields( $fields ) {
$fields[ 'your_field' ] = array(
'label' => 'Label for field',
'type' => 'text',
'required' => true,
'placeholder' => 'Placeholder text',
'priority' => 6
);
return $fields;
}
// Add new field data to meta array so its saved and stored
add_filter( 'job_application_form_posted_meta', 'custom_job_application_form_posted_meta' );
function custom_job_application_form_posted_meta( $meta ) {
$meta['your_field'] = sanitize_text_field( $_POST['your_field'] );
return $meta;
}
// Add a line to the notifcation email with custom field
add_filter( 'create_job_application_notification_message', 'custom_create_job_application_notification_message', 10, 2 );
function custom_create_job_application_notification_message( $message, $application_id ) {
$message[] = "\n" . "Your field was set as: " . get_post_meta( $application_id, 'your_field', true );
return $message;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment