Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Matty Cohen mattyza

View GitHub Profile
View README.md

Simple iDoneThis Alternative

This simple script is for logging all of the awesome things you do every day, using Terminal, and syncing them all to Dropbox. Nifty, right?

Installation

  • Grab the idid.sh file to a directory on your computer (tested with OS X).
  • Using Terminal, in the directory where you placed idid.sh, run the following commands:
  • mv idid.sh /usr/local/bin/idid.sh
@mattyza
mattyza / customer-centric-from-details.php
Created Mar 10, 2016
Use the customer's details as the "From" information for "New Order" emails in WooCommerce.
View customer-centric-from-details.php
function custom_use_customer_from_address ( $from_email, $obj ) {
if ( is_a( $obj, 'WC_Email_New_Order' ) ) {
$address_details = $obj->object->get_address( 'billing' );
if ( isset( $address_details['email'] ) && '' != $address_details['email'] ) {
$from_email = $address_details['email'];
}
}
return $from_email;
}
add_filter( 'woocommerce_email_from_address', 'custom_use_customer_from_address', null, 2 );
@mattyza
mattyza / matty-double-post-type-rewrite-rule-example.php
Last active Aug 29, 2015
A WordPress custom rewrite rule example, combining two post types.
View matty-double-post-type-rewrite-rule-example.php
<?php
/**
* Plugin Name: Double Post Type Rewrite Rule Example
* Plugin URI: https://gist.github.com/mattyza/7dfd156992f23835f68e
* Description: Adds a custom rewrite rule to mimic http://domain.com/post-type-01/post-type-02/.
* Author: Matty Cohen
* Author URI: http://matty.co.za/
* Version: 1.0.0
* Stable tag: 1.0.0
* License: GPL v3 - http://www.gnu.org/licenses/old-licenses/gpl-3.0.html
@mattyza
mattyza / matty-profile-rewrite.php
Created Aug 22, 2012
Modify the "/author" rewrite rule in WordPress to read "/profile" (permalinks refresh required).
View matty-profile-rewrite.php
<?php
/**
* Plugin Name: Add "/profile" URL rewrite rule.
* Version: 1.0.0
* Author: Matty
* Description: Add a rewrite rule to redirect "/profile" URLs to the appropriate author archive screen.
*/
new Matty_Profile_Rewrite();
You can’t perform that action at this time.