Skip to content

Instantly share code, notes, and snippets.

:shipit:
Working from home

Mike Jolley mikejolley

:shipit:
Working from home
Block or report user

Report or block mikejolley

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mikejolley
mikejolley / template-print-processing-orders.php
Created Nov 4, 2011
WooCommerce - Print Processing orders. A template page snippet to (if you are logged in as admin) output all of your orders with 'processing' status (paid) ready for printing.
View template-print-processing-orders.php
<?php
/*
Template Name: Print Processing Orders :)
*/
if (!is_user_logged_in() || !current_user_can('manage_options')) wp_die('This page is private.');
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@mikejolley
mikejolley / gist:1425282
Created Dec 2, 2011
This snippet lets you edit the icon for the PayPal gateway in WooCommerce.
View gist:1425282
add_filter('woocommerce_paypal_icon', 'custom_woocommerce_paypal_icon')
function custom_woocommerce_paypal_icon( $url ) {
$url = 'http://yoursite,com/youriconurl.png';
return $url;
}
@mikejolley
mikejolley / template-stock-report.php
Created Dec 5, 2011
WooCommerce - Stock Report. A template page snippet to (if you are logged in as admin) output a list of products/stock (which you are managing stock for) ready for printing.
View template-stock-report.php
<?php
/*
Template Name: Stock Report :)
*/
if (!is_user_logged_in() || !current_user_can('manage_options')) wp_die('This page is private.');
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@mikejolley
mikejolley / gist:1503854
Created Dec 20, 2011
Extra Profile Fields - simple code to add extra user meta fields to the back-end, place in functions.php
View gist:1503854
add_action( 'show_user_profile', 'show_extra_profile_fields', 10 );
add_action( 'edit_user_profile', 'show_extra_profile_fields', 10 );
function show_extra_profile_fields( $user ) { ?>
<h3><?php _e('Extra Profile Information'); ?></h3>
<table class="form-table">
<tr>
@mikejolley
mikejolley / gist:1547491
Created Jan 1, 2012
WooCommerce - A filter to add a tracking (or any other field for that matter) to order emails to customers.
View gist:1547491
/* To use:
1. Add this snippet to your theme's functions.php file
2. Change the meta key names in the snippet
3. Create a custom field in the order post - e.g. key = "Tracking Code" value = abcdefg
4. When next updating the status, or during any other event which emails the user, they will see this field in their email
*/
add_filter('woocommerce_email_order_meta_keys', 'my_custom_order_meta_keys');
function my_custom_order_meta_keys( $keys ) {
$keys[] = 'Tracking Code'; // This will look for a custom field called 'Tracking Code' and add it to emails
@mikejolley
mikejolley / gist:1554483
Created Jan 3, 2012
WooCommerce - A filter to add product links to order emails
View gist:1554483
/* Add this code to functions.php of your theme */
add_filter('woocommerce_order_product_title', 'custom_order_product_title', 10, 2);
function custom_order_product_title( $name, $product ) {
if ($product->id) return '<a href="'.home_url( '?p=' . $product->id ).'">'. $name .'</a>';
return $name;
}
@mikejolley
mikejolley / gist:1565309
Created Jan 5, 2012
WooCommerce - Filters to add custom currencies and symbols
View gist:1565309
add_filter( 'woocommerce_currencies', 'add_my_currency' );
function add_my_currency( $currencies ) {
$currencies['ABC'] = __( 'Currency name', 'woocommerce' );
return $currencies;
}
add_filter('woocommerce_currency_symbol', 'add_my_currency_symbol', 10, 2);
function add_my_currency_symbol( $currency_symbol, $currency ) {
@mikejolley
mikejolley / gist:1597957
Created Jan 12, 2012
WooCommerce - Replace '' with 'Call for price' when price is left blank
View gist:1597957
/**
* This code should be added to functions.php of your theme
**/
add_filter('woocommerce_empty_price_html', 'custom_call_for_price');
function custom_call_for_price() {
return 'Call for price';
}
@mikejolley
mikejolley / gist:1604009
Created Jan 13, 2012
WooCommerce - Add a special field to the checkout, order emails and user/order meta
View gist:1604009
/**
* Add the field to the checkout
**/
add_action('woocommerce_after_order_notes', 'my_custom_checkout_field');
function my_custom_checkout_field( $checkout ) {
echo '<div id="my_custom_checkout_field"><h3>'.__('My Field').'</h3>';
/**
@mikejolley
mikejolley / gist:1622323
Created Jan 16, 2012
WooCommerce - Change default catalog sort order
View gist:1622323
/**
* This code should be added to functions.php of your theme
**/
add_filter('woocommerce_default_catalog_orderby', 'custom_default_catalog_orderby');
function custom_default_catalog_orderby() {
return 'date'; // Can also use title and price
}
You can’t perform that action at this time.