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
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 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 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 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 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
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
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' . ' <example@example.com>';
return $headers;
}
@davoraltman
davoraltman / functions.php
Last active July 3, 2017 16:38
Change the From details in the Application email
add_filter('create_job_application_notification_headers','dm_job_application_headers');
function dm_job_application_headers($headers) {
$headers[] = 'From: ' . 'My Custom From Name' . ' <example@example.com>';
return $headers;
}
@davoraltman
davoraltman / functions.php
Last active July 3, 2017 16:26
Change From details in the Application email in WPJM
add_filter('create_job_application_notification_headers','daki_job_application_headers');
function daki_job_application_headers($headers) {
$headers[] = 'From: ' . 'Salon Express' . ' <info@salonexpress.com.au>';
return $headers;
}
@davoraltman
davoraltman / functions.php
Created June 27, 2017 12:28
Make custom meta field searchable
function my_wpjm_meta_key_dm() {
global $wpdb, $job_manager_keyword;
$searchable_meta_keys[] = '_my_meta_field';
return $searchable_meta_keys;
}
add_filter('job_listing_searchable_meta_keys', 'my_wpjm_meta_key_dm');