Skip to content

Instantly share code, notes, and snippets.

View mikejolley's full-sized avatar

Mike Jolley mikejolley

View GitHub Profile
/** Code goes in theme functions.php **/
add_filter( 'resume_manager_candidate_dashboard_login_url', 'custom_resume_manager_candidate_dashboard_login_url' );
function custom_resume_manager_candidate_dashboard_login_url() {
return 'http://someurl.com';
}
@mikejolley
mikejolley / gist:5b2bf3db1cde48a86802
Created April 23, 2015 17:02
WP Job Manager Alerts - Custom Login URL
/** Code goes in theme functions.php **/
add_filter( 'job_manager_alerts_login_url', 'custom_job_manager_alerts_login_url' );
function custom_job_manager_alerts_login_url() {
return 'http://someurl.com';
}
@mikejolley
mikejolley / gist:2452564524082cba2a77
Created April 23, 2015 16:08
Disable bookmarks for users without a subscription
add_action( 'init', 'disable_bookmark_functionality' );
function disable_bookmark_functionality() {
$subscription_product_id = '116'; // Customise me!
if ( ! is_user_logged_in() || ! WC_Subscriptions_Manager::user_has_subscription( get_current_user_id(), $subscription_product_id ) ) {
remove_action( 'single_job_listing_meta_after', array( $GLOBALS['job_manager_bookmarks'], 'bookmark_form' ) );
remove_action( 'single_resume_start', array( $GLOBALS['job_manager_bookmarks'], 'bookmark_form' ) );
}
}
@mikejolley
mikejolley / gist:15c5c28c9950b3801f01
Created April 20, 2015 17:37
Notify Admin on Resume Edit
<?php
add_action( 'post_updated', 'notify_admin_on_resume_edit' );
function notify_admin_on_resume_edit( $id ) {
if ( 'resume' === get_post_type( $id ) && ! current_user_can( 'manage_options' ) ) {
wp_mail( get_option( 'admin_email' ), 'Resume Edited', 'Resume ' . $id . ' has been edited' );
}
}
@mikejolley
mikejolley / gist:c8f09b2a12156c08afcb
Created April 20, 2015 17:24
Check a checkbox field in Applications v2
add_filter( 'job_application_form_fields', 'custom_job_application_form_fields' );
function custom_job_application_form_fields( $fields ) {
$fields['checkbox']['value'] = 1;
return $fields;
}
add_filter( 'job_manager_job_listing_data_fields', 'custom_email_job_manager_job_listing_data_fields' );
function custom_email_job_manager_job_listing_data_fields( $fields ) {
global $post;
if ( ! metadata_exists( 'post', $post->ID, '_application' ) ) {
$fields['_application']['value'] = 'add custom email here';
}
return $fields;
}
add_filter( 'register_post_type_job_listing', 'custom_register_post_type_job_listing' );
function custom_register_post_type_job_listing( $args ) {
$args['support'][] = 'thumbnail';
return $args;
}
@mikejolley
mikejolley / gist:5fe3ff4e9a069b1d3c1c
Created April 2, 2015 16:09
Limit max upload file size for non-admin users
add_filter( 'upload_size_limit', 'limit_upload_size_limit_for_non_admin' );
function limit_upload_size_limit_for_non_admin( $limit ) {
if ( ! current_user_can( 'manage_options' ) ) {
$limit = '1000000'; // 1mb in bytes
}
return $limit;
}
add_filter( 'job_application_form_fields', 'alter_upload_cv_test' );
function alter_upload_cv_test( $fields ) {
$fields['application_attachment']['label'] = 'Custom Label';
$fields['application_attachment']['description'] = 'Custom desc';
return $fields;
}
@mikejolley
mikejolley / gist:903306df7c07a2c8ee2b
Created March 23, 2015 23:18
Change "resume" to "cv" across all plugins
add_filter( 'gettext', 'change_resume_to_cv', 20, 3 );
/**
* Change "resume" to "cv"
*/
function change_resume_to_cv( $translated_text, $text, $domain ) {
$translated_text = str_replace(
array(
'Resume',
'resume'