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 VAT and SSN fields in billing address display | |
add_filter( 'woocommerce_order_formatted_billing_address', 'custom_add_vat_ssn_formatted_billing_address', 10, 2 ); | |
function custom_add_vat_ssn_formatted_billing_address( $fields, $order ) { | |
$fields['vat'] = $order->billing_vat; | |
$fields['ssn'] = $order->billing_ssn; | |
return $fields; | |
} | |
add_filter( 'woocommerce_my_account_my_address_formatted_address', 'custom_my_account_my_address_formatted_address', 10, 3 ); |
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
Array | |
( | |
[orders] => Array | |
( | |
[0] => Array | |
( | |
[id] => 3520 | |
[order_number] => 3520 | |
[created_at] => 2016-09-01T20:37:12Z | |
[updated_at] => 2016-09-01T20:37:12Z |
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
require_once 'lib/woocommerce-api.php'; | |
$consumer_key = 'ck_b19dd8998398a762d0a5062e9fd1cef1c38bdcf1'; | |
$consumer_secret = 'cs_12bb4182989d216d02a773586d680d481caef086'; | |
$store_url = 'http://shop.lifespa.com/'; | |
$options = array( | |
'debug' => true, | |
'return_as_array' => true, | |
'validate_url' => false, | |
'timeout' => 30, |
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
//** Wholesale pricing based on 'wholesaler' role | |
// checks if the current user is capable to have the wholesale pricing | |
function gum_woo_wholesale_pricing_applies(){ | |
return (bool) ( current_user_can('wholesaler') && ( !is_admin() || is_ajax() ) ); | |
} | |
// wholesale price when available for both Simple & Variable product type | |
function gum_woo_wholesale_price_get( $product ) { | |
if( $product->is_type( array('simple', 'variable') ) && get_post_meta( $product->id, '_wholesale_price', true ) > 0 ){ | |
return get_post_meta( $product->id, '_wholesale_price', true ); |
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
//* Restore get shortlinks in editor | |
add_filter( 'get_shortlink', 'gumtheme_restore_wp_getshortlink' ); | |
function gumtheme_restore_wp_getshortlink( $shortlink ) { | |
return $shortlink; | |
} |
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
//* Discourage search engines from indexing this site | |
add_action('init', 'gumtheme_set_robots_access'); | |
function gumtheme_set_robots_access(){ | |
if(WP_ENV == 'staging' && get_option('blog_public') == '1') | |
update_option('blog_public', '0'); | |
if(WP_ENV == 'production' && get_option('blog_public') == '0') | |
update_option('blog_public', '1'); | |
} |
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
//Delete old custom capabilities | |
add_action( 'admin_init', 'gum_delete_woo_caps' ); | |
function gum_delete_woo_caps(){ | |
$delete_caps = array( | |
'assign_product_terms', | |
'assign_shop_order_terms', | |
'assign_shop_webhook_terms', | |
'delete_others_products', | |
'delete_others_shop_coupons', | |
'delete_others_shop_orders', |
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
/***** MAINTENANCE *****/ | |
//* Redirect for temp landing page | |
add_action( 'template_redirect', 'gum_redirect_maintenance_page' ); | |
function gum_redirect_maintenance_page() { | |
$redirect = FALSE; | |
$page = home_url( '/maintenance/' ); //slug for wp page | |
if ( $redirect && !is_user_logged_in() && trim( $_SERVER['REQUEST_URI'], '/' ) != 'maintenance' && $_SERVER['REQUEST_URI'] != '/wp-admin/' ) : | |
wp_redirect( $page ); | |
exit; |
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_filter( 'tribe_get_cost', 'gum_wootickets_tribe_get_cost', 10, 3 ); | |
function gum_wootickets_tribe_get_cost( $cost, $postId, $withCurrencySymbol ) { | |
if ( empty($cost) && class_exists('TribeWooTickets') ) { | |
// see if the event has tickets associated with it | |
$wootickets = TribeWooTickets::get_instance(); | |
$ticket_ids = $wootickets->get_Tickets_ids( $postId ); | |
if ( empty($ticket_ids) ) { | |
return ''; |
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 Functions | |
* | |
* @category WP Plugins | |
* @author Jayson T. Cote | |
* @link https://tri.be/shop/wordpress-events-calendar/ | |
*/ | |
if (tribe_is_event() || tribe_is_event_category() || tribe_is_in_main_loop() || tribe_is_view() || 'tribe_events' == get_post_type() || is_singular( 'tribe_events' )) { |
NewerOlder