Last active
August 29, 2015 14:03
-
-
Save mikejolley/70587a1f89c12c3540d4 to your computer and use it in GitHub Desktop.
Job Applications - Form customisation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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