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 | |
/* From https://www.usps.com/send/official-abbreviations.htm */ | |
$us_state_abbrevs_names = array( | |
'AL'=>'ALABAMA', | |
'AK'=>'ALASKA', | |
'AS'=>'AMERICAN SAMOA', | |
'AZ'=>'ARIZONA', | |
'AR'=>'ARKANSAS', |
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 | |
// check if hashed password is SHA1 and update as necessary, see function comments | |
add_filter( 'check_password', 'check_sha1_password', 10, 4 ); | |
/** | |
* Check if a user has a SHA1 password hash, allows login if password hashes match, then updates password hash to wp format | |
* | |
* Hooks into check_password filter, mostly copied from md5 upgrade function with pluggable.php/wp_check_password | |
* | |
* @param string $check |
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
add_action( 'init', 'maybe_load_jquery_from_google', 1 ); | |
function maybe_load_jquery_from_google() { | |
// do not load in wp-admin | |
if( is_admin() ) | |
return; | |
// Load from SSL if necessary | |
$protocol = is_ssl() ? 'https:' : 'http:'; | |
$url = $protocol . '//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js'; |
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 | |
// only process image files | |
$accepted_extensions = array( 'jpg', 'jpeg', 'png' ); | |
// set final size of cropped image | |
$image_size_width = 892; | |
$image_size_height = 892; | |
//only process files in directory that script is in |
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
// Hide standard shipping option when free shipping is available | |
add_filter( 'woocommerce_available_shipping_methods', 'hide_standard_shipping_when_free_is_available' , 10, 1 ); | |
/** | |
* Hide Standard Shipping option when free shipping is available | |
* | |
* @param array $available_methods | |
*/ | |
function hide_standard_shipping_when_free_is_available( $available_methods ) { |
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 | |
/** | |
* FTP with Implicit SSL/TLS Class | |
* | |
* Simple wrapper for cURL functions to transfer an ASCII file over FTP with implicit SSL/TLS | |
* | |
* @category Class | |
* @author Max Rice | |
* @since 1.0 | |
*/ |
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
<methodCall> | |
<methodName> | |
wc.updateOrderStatus | |
</methodName> | |
<params> | |
<param> | |
<value> | |
<struct> | |
<member> | |
<name>username</name> |
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
add_action( 'woocommerce_init', 'load_my_shipping_class' ); | |
function load_my_shipping_class() { | |
class My_Shipping_Class extends WC_Shipping_Method { | |
// foo | |
} | |
} |
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 | |
add_action( 'woocommerce_cart_loaded_from_session', function() { | |
global $woocommerce; | |
$products_in_cart = array(); | |
foreach ( $woocommerce->cart->cart_contents as $key => $item ) { | |
$products_in_cart[ $key ] = $item['data']->get_title(); | |
} |
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 | |
function add_custom_fields_to_xml( $order_data, $order ) { | |
$order_data['BillingCompanyID'] = ( isset( $order->order_custom_fields['billing_company_id'][0] ) ) ? $order->order_custom_fields['billing_company_id'][0] : ''; | |
$order_data['BillingCompanyVAT'] = ( isset( $order->order_custom_fields['billing_company_vat'][0] ) ) ? $order->order_custom_fields['billing_company_vat'][0] : ''; | |
return $order_data; | |
} | |
add_filter( 'wc_customer_order_xml_export_suite_order_export_order_list_format', 'add_custom_fields_to_xml', 10, 2 ); |
OlderNewer