This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Customize ACF path | |
*/ | |
add_filter('acf/settings/path', function ( $path ) { | |
$path = get_stylesheet_directory() . '/../vendor/advanced-custom-fields/advanced-custom-fields-pro/'; | |
return $path; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Basic Site Caching | |
* | |
* @package Basic_Site_Caching | |
* @author Weston Ruter, Google | |
* @license GPL-2.0-or-later | |
* @copyright 2019 Google Inc. | |
* | |
* @wordpress-plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function custom_tax_init(){ | |
//set some options for our new custom taxonomy | |
$args = array( | |
'label' => __( 'My Custom Taxonomy' ), | |
'hierarchical' => true, | |
'capabilities' => array( | |
// allow anyone editing posts to assign terms | |
'assign_terms' => 'edit_posts', | |
/* but you probably don't want anyone |
OlderNewer