Skip to content

Instantly share code, notes, and snippets.

View davoraltman's full-sized avatar

Davor Altman davoraltman

View GitHub Profile
@davoraltman
davoraltman / functions.php
Last active July 4, 2017 09:03
Change the From: details for the Applications Candidate notification
add_filter('create_job_application_candidate_notification_headers','dm_job_candidate_application_headers');
function dm_job_candidate_application_headers($headers) {
$headers[] = 'From: ' . 'My Custom From Name' . ' <[email protected]>';
return $headers;
}
@davoraltman
davoraltman / functions.php
Last active February 23, 2019 20:07
Add Display Job Categories Shortcode for a single listing
function dm_display_wpjm_single_categories () {
$terms = wp_get_post_terms( get_the_ID(), 'job_listing_category' );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
echo '<ul>';
foreach ( $terms as $term ) {
echo '<li>' . '<a href="' . esc_url( get_term_link( $term ) ) . '">' . $term->name . '</a></li>';
}
echo '</ul>';
}
}
@davoraltman
davoraltman / functions.php
Created July 7, 2017 06:53
Add a custom start date field displayed to the single job listing
/** added to functions.php to create Start Date field **/
add_filter( 'submit_job_form_fields', 'frontend_add_start_field' );
function frontend_add_start_field( $fields ) {
$fields['job']['job_start'] = array(
'label' => __( 'Start', 'job_manager' ),
'type' => 'text',
'required' => true,
'placeholder' => 'eg March 2017',
@davoraltman
davoraltman / functions.php
Created July 10, 2017 10:37
Remove a field from the job submission page
add_filter( 'submit_job_form_fields', 'custom_submit_job_form_fields_dm' );
function custom_submit_job_form_fields_dm( $fields ) {
// in this example, we remove the job_tags field
unset($fields['job']['job_tags']);
// And return the modified fields
return $fields;
}
@davoraltman
davoraltman / functions.php
Created July 14, 2017 09:12
Change job tagline field type
// Add your own function to filter the fields
add_filter( 'submit_job_form_fields', 'custom_submit_job_form_fields_dalt' );
// This is your function which takes the fields, modifies them, and returns them
// You can see the fields which can be changed here: https://github.com/mikejolley/WP-Job-Manager/blob/master/includes/forms/class-wp-job-manager-form-submit-job.php
function custom_submit_job_form_fields_dalt( $fields ) {
// Here we target one of the job fields (job_title) and change it's label
$fields['company']['company_tagline']['type'] = 'textarea';
@davoraltman
davoraltman / functions.php
Created July 17, 2017 07:55
Sort Indeed jobs by date
add_filter( 'job_manager_indeed_get_jobs_args', 'custom_job_manager_indeed_get_jobs_args' );
function custom_job_manager_indeed_get_jobs_args( $args ) {
$args['sort'] = 'date';
return $args;
}
@davoraltman
davoraltman / functions.php
Created July 19, 2017 06:14
Change resume slug
add_action( 'init', 'jm_update_resume_slug' );
function jm_update_resume_slug( ) {
$resume_args = get_post_type_object('resume');
if ( ! empty( $resume_args ) ) {
$resume_args->rewrite = array(
'slug' => 'cv',
'with_front' => false,
'feeds' => false,
'pages' => false,
);
@davoraltman
davoraltman / functions.php
Created July 20, 2017 23:17
Change the From email and name
add_filter( 'create_job_application_notification_headers','dm_job_application_headers', 10, 3 );
function dm_job_application_headers( $headers, $job_id, $application_id ) {
$candidate_name = get_the_title( $application_id );
$candidate_email = get_post_meta( $application_id, '_candidate_email', true );
$headers[] = 'From: ' . $candidate_name . ' <' . $candidate_email . '>';
return $headers;
}
@davoraltman
davoraltman / functions.php
Created July 25, 2017 17:24
Prefill the company logo field
add_filter('submit_job_form_fields', 'dm_prefill_company_logo');
function dm_prefill_company_logo( $fields ) {
$fields['company']['company_logo']['value'] = 'full_url_to_the_logo';
return $fields;
}
@davoraltman
davoraltman / functions.php
Created July 26, 2017 15:58
Change the candidate title
// Add your own function to filter the fields
add_filter( 'submit_resume_form_fields', 'custom_submit_resume_form_fields_dm' );
// This is your function which takes the fields, modifies them, and returns them
function custom_submit_resume_form_fields_dm( $fields ) {
// Here we target one of the job fields (candidate name) and change it's label
$fields['resume_fields']['candidate_title']['label'] = "My pro title";
// And return the modified fields
return $fields;
}