Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
Working from home

Mike Jolley mikejolley

:shipit:
Working from home
View GitHub Profile
@mikejolley
mikejolley / functions.php
Last active Jul 13, 2020 — forked from claudiosanches/functions.php
WooCommerce - Hide shipping rates when free shipping is available.
View functions.php
<?php
/**
* Hide shipping rates when free shipping is available.
* Updated to support WooCommerce 2.6 Shipping Zones.
*
* @param array $rates Array of rates found for the package.
* @return array
*/
function my_hide_shipping_when_free_is_available( $rates ) {
$free = array();
@mikejolley
mikejolley / functions.php
Last active Jul 31, 2017 — forked from jameskoster/functions.php
WooCommerce - Adjust the quantity incrementer
View functions.php
// Simple products
add_filter( 'woocommerce_quantity_input_args', 'jk_woocommerce_quantity_input_args', 10, 2 );
function jk_woocommerce_quantity_input_args( $args, $product ) {
if ( is_singular( 'product' ) ) {
$args['input_value'] = 2; // Starting value (we only want to affect product pages, not cart)
}
$args['max_value'] = 80; // Maximum value
$args['min_value'] = 2; // Minimum value
$args['step'] = 2; // Quantity steps
@mikejolley
mikejolley / functions.php
Last active Sep 9, 2015 — forked from spencerfinnell/functions.php
Add a region bias when geocoding addresses.
View functions.php
<?php
/**
* Plugin Name: Listify Region Bias
*/
function listify_region_bias() {
return 'country_code';
}
add_filter( 'job_manager_geolocation_region_cctld', 'listify_region_bias' );
View jobapplication
<?php if ( ( $apply = get_the_job_application_method() ) && current_user_can( 'employer' ) ) :
wp_enqueue_script( 'wp-job-manager-job-application' );
?>
<div class="job_application application">
<?php do_action( 'job_application_start', $apply ); ?>
<input type="button" class="application_button button" value="<?php _e( 'Apply for job', 'wp-job-manager' ); ?>" />
<div class="application_details">
<?php
@mikejolley
mikejolley / gist:9f5adb8d194d7681e7b7
Last active Feb 25, 2020 — forked from corsonr/gist:6681929
WooCommerce - Create a product categories dropdown list in a shortcode
View gist:9f5adb8d194d7681e7b7
<?php
/**
* WooCommerce Extra Feature
* --------------------------
*
* Register a shortcode that creates a product categories dropdown list
*
* Use: [product_categories_dropdown orderby="title" count="0" hierarchical="0"]
*/
View gistify546404.php
<?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' );
View gist:d80573483e1e2437b420
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;
}
View gist:20d77105f88e54f0c01e
// Hook into user_has_cap filter. This assumes you have setup resumes to require the capability 'has_active_job_package'
add_filter( 'user_has_cap', 'has_active_job_package_or_job_capability_check', 10, 3 );
/**
* has_active_job_package_or_job_capability_check()
*
* Filter on the current_user_can() function.
*
* @param array $allcaps All the capabilities of the user
* @param array $cap [0] Required capability
@mikejolley
mikejolley / gist:11171530
Last active May 16, 2019 — forked from woogist/gist:6065863
Hide all/some shipping options when free shipping is available
View gist:11171530
/**
* woocommerce_package_rates is a 2.1+ hook
*/
add_filter( 'woocommerce_package_rates', 'hide_shipping_when_free_is_available', 10, 2 );
/**
* Hide shipping rates when free shipping is available
*
* @param array $rates Array of rates found for the package
* @param array $package The package array/object being shipped
@mikejolley
mikejolley / gist:9971149
Last active Jan 15, 2018 — forked from woogist/gist:6267983
WC customising checkout fields using actions and filters - Lesson 3 snippet 4
View gist:9971149
/**
* Display field value on the order edit page
*/
add_action( 'woocommerce_admin_order_data_after_billing_address', 'my_custom_checkout_field_display_admin_order_meta', 10, 1 );
function my_custom_checkout_field_display_admin_order_meta($order){
echo '<p><strong>'.__('My Field').':</strong> ' . get_post_meta( $order->id, 'My Field', true ) . '</p>';
}
You can’t perform that action at this time.