Skip to content

Instantly share code, notes, and snippets.

View mikejolley's full-sized avatar

Mike Jolley mikejolley

View GitHub Profile
@mikejolley
mikejolley / gist:118219fd5d887b522ea7
Created March 21, 2015 01:06
Category and Job Region in job permalink - Must save permalinks after adding the code to functions.php
function job_listing_post_type_link( $permalink, $post ) {
// Abort if post is not a job
if ( $post->post_type !== 'job_listing' ) {
return $permalink;
}
// Abort early if the placeholder rewrite tag isn't in the generated URL
if ( false === strpos( $permalink, '%' ) ) {
return $permalink;
}
@mikejolley
mikejolley / gist:1682412ecf76ac1afbbe
Created March 11, 2015 18:54
Set Yoast WordPress SEO Facebook opengraph image to company logo image
add_action( 'job_manager_update_job_data', 'wpjm_set_yoast_opengraph_image', 10, 2 );
function wpjm_set_yoast_opengraph_image( $job_id, $values ) {
update_post_meta( $job_id, '_yoast_wpseo_opengraph-image', $values['company']['company_logo'] );
}
@mikejolley
mikejolley / gist:450c498b4681082e3a5d
Last active August 29, 2015 14:16
Change resume notification recipient - place code in theme functions.php
add_filter( 'resume_manager_new_resume_notification_recipient', 'change_resume_manager_new_resume_notification_recipient' );
function change_resume_manager_new_resume_notification_recipient( $email ) {
return '[email protected]';
}
@mikejolley
mikejolley / gist:c420f57d0ef10cb4a32f
Created March 9, 2015 17:33
Job Applications - CC email
<?php
add_filter( 'create_job_application_notification_headers', 'job_applications_cc_email' );
function job_applications_cc_email( $headers ) {
$headers[] = 'Cc:[email protected]';
return $headers;
}
@mikejolley
mikejolley / gist:d2571b694d2f13582691
Created March 6, 2015 23:05
Force Indeed Keyword
add_filter( 'job_manager_indeed_import_format_keyword', 'custom_job_manager_indeed_import_format_keyword' );
function custom_job_manager_indeed_import_format_keyword( $keyword ) {
$keyword .= ' add something to the keyword';
return $keyword;
}
add_filter( 'submit_job_form_save_job_data', 'custom_submit_job_form_save_job_data', 10, 5 );
function custom_submit_job_form_save_job_data( $data, $post_title, $post_content, $status, $values ) {
$job_slug = array();
$job_slug[] = $post_title;
// Add location
if ( ! empty( $values['job']['job_location'] ) )
@mikejolley
mikejolley / gist:11817ab5bd3011ee2fae
Last active August 29, 2015 14:16
Resume Manager RECAPTCHA
add_action( 'submit_resume_form_resume_fields_end', 'recaptcha_field' );
add_filter( 'submit_resume_form_validate_fields', 'validate_recaptcha_field' );
add_filter( 'job_manager_job_listing_data_fields', 'remove_author_type_field' );
function remove_author_type_field( $fields ) {
global $post;
if ( isset( $fields['_job_author'] ) ) {
$fields['_job_author']['type'] = 'text';
$fields['_job_author']['value'] = $post->post_author;
}
return $fields;
}
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['jt'] = 'fulltime';
return $args;
}
add_filter( 'the_company_logo', 'custom_get_the_company_logo', 10, 2 );
function custom_get_the_company_logo( $logo, $post ) {
if ( $post->post_author ) {
$avatar_img = get_avatar( $post->post_author );
preg_match( '#src=["|\'](.+)["|\']#Uuis', $avatar_img, $matches );
return ! empty( $matches[1] ) ? $matches[1] : '';
}
return $logo;
}