Skip to content

Instantly share code, notes, and snippets.

View mikejolley's full-sized avatar

Mike Jolley mikejolley

View GitHub Profile
<?php
/**
* Plugin Name: CC an Email on Applications
* Description: Does what it says on the tin.
* Version: 1.0
* Author: Adam Heckler
* License: GPL v3
*/
add_filter( 'create_job_application_notification_headers', 'job_applications_cc_email' );
add_filter( 'woocommerce_email_order_meta_fields', 'custom_woocommerce_email_order_meta_fields', 10, 3 );
function custom_woocommerce_email_order_meta_fields( $fields, $sent_to_admin, $order ) {
$fields['meta_key'] = array(
'label' => __( 'Label' ),
'value' => get_post_meta( $order->id, 'meta_key', true ),
);
return $fields;
}
@mikejolley
mikejolley / gist:1d13a6d80b95729b70d8
Created August 5, 2015 16:02
Turn off "is_sold_individually" for job packs
add_filter( 'wcpl_job_package_is_sold_individually', '__return_false' );
add_filter( 'wcpl_resume_package_is_sold_individually', '__return_false' );
add_filter( 'job_filter_tag_cloud', 'custom_job_filter_tag_cloud' );
function custom_job_filter_tag_cloud( $atts ) {
$atts['number'] = 5;
return $atts;
}
@mikejolley
mikejolley / gist:68f46aa2f2a38fa59090
Created July 8, 2015 16:40
Adding a Salary Filter to the Job Search Form
<?php
/**
* This can either be done with a filter (below) or the field can be added directly to the job-filters.php template file!
*
* job-manager-filter class handling was added in v1.23.6
*/
add_action( 'job_manager_job_filters_search_jobs_end', 'filter_by_salary_field' );
function filter_by_salary_field() {
?>
add_action( 'job_application_email_add_shortcodes', 'register_job_ref_shortcode' );
function register_job_ref_shortcode( $data ) {
extract( $data );
add_shortcode( 'job_ref', function( $atts, $content = '' ) use( $job_id ) {
return job_application_email_shortcode_handler( $atts, $content, get_post_meta( $job_id, '_job_ref', true ) );
} );
}
@mikejolley
mikejolley / gist:9b82e46548301c192aa0
Created June 23, 2015 14:14
ShareDaddy integration code for WooCommerce
function sharedaddy_for_woocommerce() {
?>
<div class="social"><?php echo sharing_display(); ?></div>
<?php
}
add_action( 'woocommerce_share', 'sharedaddy_for_woocommerce' );
@mikejolley
mikejolley / gist:31390769327c16fba662
Created June 23, 2015 14:04
ShareThis integration code for WooCommerce
if ( ! defined( 'SHARETHIS_PUBLISHER_ID' ) ) {
define( 'SHARETHIS_PUBLISHER_ID', 'enter your id here' );
}
function sharethis_for_woocommerce() {
global $post;
$thumbnail_id = get_post_thumbnail_id( $post->ID );
$thumbnail = $thumbnail_id ? current( wp_get_attachment_image_src( $thumbnail_id, 'large' ) ) : '';
?>
add_action( 'woocommerce_flat_rate_shipping_add_rate', 'add_another_custom_flat_rate', 10, 2 );
function add_another_custom_flat_rate( $method, $rate ) {
$new_rate = $rate;
$new_rate['id'] .= ':' . 'custom_rate_name'; // Append a custom ID
$new_rate['label'] = 'Rushed Shipping'; // Rename to 'Rushed Shipping'
$new_rate['cost'] += 2; // Add $2 to the cost
// Add it to WC
$method->add_rate( $new_rate );
@mikejolley
mikejolley / gist:c15c8a0e79d22df3066e
Last active August 29, 2015 14:23
Applications RECAPTCHA
add_action( 'job_application_form_fields_end', 'recaptcha_field' );
add_filter( 'application_form_validate_fields', 'validate_recaptcha_field' );