Skip to content

Instantly share code, notes, and snippets.

View mikejolley's full-sized avatar

Mike Jolley mikejolley

View GitHub Profile
@mikejolley
mikejolley / gist:8cf66cc8744ca6fa0774
Last active August 29, 2015 14:07
Customise the email sent by the Job Application plugin
<?php
/**
* This code can be placed inside a custom plugin, or the theme functions.php file.
*
* The admin email is simply an array of content which is ran through a filter then 'imploded' and sent.
* The content can be customised through a filter.
*
* The default content looks like this in the plugin:
*
@mikejolley
mikejolley / gist:34c56160d9ac8c607144
Created October 17, 2014 16:23
Resume Manager - Add meta data to the permalinks
<?php
/**
* Add rewrite tags for the data we want to insert and define the structure of the permalink.
*
* You need to go to Settings > Permalinks and save for these rules to be added.
*/
function add_resume_rewrite_rules(){
add_rewrite_tag( '%resume%', '([^/]+)', 'resume=' );
add_rewrite_tag( '%candidate_title%', '([^/]+)', 'candidate_title=' );
@mikejolley
mikejolley / gist:12260c4195a307d0d0d9
Last active August 29, 2015 14:08
Add a telephone field to the application form
<?php // You don't need this line if <?php is already present in your file :)
// First, add the field to the form. This will be a text field.
add_filter( 'job_application_form_fields', 'add_application_form_tel_field' );
function add_application_form_tel_field( $fields ) {
$fields[ 'tel' ] = array(
'label' => 'Telephone Number',
'type' => 'text',
'required' => true,
add_filter( 'apply_with_resume_email_message', 'custom_apply_with_resume_email_message', 10, 4 );
function custom_apply_with_resume_email_message( $message, $user_id, $job_id, $resume_id ) {
$resume = get_post( $resume_id );
$message['resume_content'] = "\n\n-----------\n\n" . nl2br( $resume->post_content );
return $message;
}
<?php
global $job_manager_tags;
remove_filter( 'the_job_description', array( $job_manager_tags, 'display_tags' ) );
@mikejolley
mikejolley / gist:8f07a0b6f18856e7339d
Created November 25, 2014 22:06
Send a confirmation email to the CANDIDATE on job application
<?php
add_action( 'new_job_application', 'send_new_job_application_confirmation', 10, 2 );
function send_new_job_application_confirmation( $application_id, $job_id ) {
$candidate_email = get_post_meta( $application_id, '_candidate_email', true );
$message = sprintf( "Thanks for your application for '%s'. We'll get back to you as soon as possible.", get_the_title( $job_id ) );
wp_mail( $candidate_email, 'Your Application on ' . get_bloginfo( 'name' ), $message );
}
@mikejolley
mikejolley / gist:124fd9701e7519fc556b
Created December 11, 2014 20:48
Job Manager - Remove RSS LINK
// Goes goes in theme functions.php
add_filter( 'job_manager_job_filters_showing_jobs_links', 'custom_job_manager_job_filters_showing_jobs_links' );
function custom_job_manager_job_filters_showing_jobs_links( $links ) {
unset( $links['rss_link'] );
return $links;
}
@mikejolley
mikejolley / gist:55408b4ee3ebd847dfc0
Created December 14, 2014 11:02
Resume Manager - Turn skills into multiselect field
// Add your own function to filter the fields - code goes in theme functions.php
add_filter( 'submit_resume_form_fields', 'custom_submit_resume_form_fields' );
// This is your function which takes the fields, modifies them, and returns them
function custom_submit_resume_form_fields( $fields ) {
// Here we target one of the job fields (candidate name) and change it's label
$fields['resume_fields']['resume_skills']['type'] = 'term-multiselect';
$fields['resume_fields']['resume_skills']['taxonomy'] = 'resume_skill';
@mikejolley
mikejolley / gist:27481875613adf17164f
Created December 18, 2014 18:47
Don't pre-fill application email
add_filter( 'job_manager_job_listing_data_fields', 'custom_job_manager_job_listing_data_fields' );
function custom_job_manager_job_listing_data_fields( $fields ) {
unset( $fields['_application']['value'] );
return $fields;
}
@mikejolley
mikejolley / gist:ed63fe80820ce2a24d42
Created January 7, 2015 17:29
WC Paid Listings - Give a free package to a new user!
<?php
add_action( 'user_register', 'give_wcpl_user_package_on_registration' );
function give_wcpl_user_package_on_registration( $user_id ) {
global $wpdb;
$wpdb->insert(
"{$wpdb->prefix}wcpl_user_packages",
array(
'user_id' => $user_id,