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 | |
/** | |
* My Account page | |
* | |
* @author WooThemes | |
* @edited by McLane Creative | |
* @package WooCommerce/Templates | |
* @version 3.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
<?php | |
class My_Custom_My_Account_Endpoint { | |
/** | |
* Custom endpoint name. | |
* | |
* @var string | |
*/ | |
public static $endpoint = 'my-custom-endpoint'; |
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
// Rob Scott makes the icon for diners and jcb disappear pfft like magic | |
function rs_removed_icon( $icons ) { | |
$icons = str_replace( '<img src="[your absolute url to...]/assets/images/icons/credit-cards/jcb.svg" alt="JCB" width="32" style="margin-left: 0.3em" />', '', $icons ); | |
$icons = str_replace( '<img src="[your absolute url to...]/assets/images/icons/credit-cards/diners.svg" alt="Diners" width="32" style="margin-left: 0.3em" />', '', $icons ); | |
return $icons; | |
} | |
add_filter( 'woocommerce_gateway_icon', 'rs_removed_icon'); |
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 a checkout padlock and alternative message in the Pay Now button - by Robin Scott of Silicon Dales | |
add_filter( 'woocommerce_order_button_text', 'sd_custom_order_button_text' ); | |
function sd_custom_order_button_text() { | |
return __( 'Checkout Securely 🔒', 'woocommerce' ); | |
} |
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
a:focus, | |
.focus a { | |
outline: none !important; | |
} |
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 a shortcode to dispay [now_time] for the time in Europe/London - by Robin Scott of Silicon Dales | |
function sd_now_time_formated($atts) { | |
date_default_timezone_set("Europe/London"); | |
$i = date('g:i A'); | |
return $i; | |
} | |
add_shortcode('now_time', 'sd_now_time_formated'); |
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
// posted by Robin Scott https://silicondales.com/tutorials/woocommerce-tutorials/woocommerce-tutorial-allow-users-purchase-items/ - prevent user adding item to cart if they bought it before... | |
add_filter('woocommerce_add_to_cart_validation','sd_bought_before_woocommerce_add_to_cart_validation',20, 2); | |
function sd_bought_before_woocommerce_add_to_cart_validation($valid, $product_id){ | |
$current_user = wp_get_current_user(); | |
if ( wc_customer_bought_product( $current_user->user_email, $current_user->ID, $product_id)) { | |
wc_add_notice( __( 'ERROR MESSAGE GOES HERE SORRY YOU CANNOT BUY ANYTHING TWICE OKAY!!', 'woocommerce' ), 'error' ); | |
$valid = false; | |
} | |
return $valid; | |
} |
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
// Added by Robin Scott of Silicon Dales here to demonstrate My Account / login links: https://silicondales.com/tutorials/woocommerce/display-woocommerce-account-page-link-logged-users-login-register-link-not-logged/ | |
<?php if ( is_user_logged_in() ) { ?> | |
<a href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>" title="<?php _e('My Account','woocommerce'); ?>"><?php _e('My Account','woocommerce'); ?></a> | |
<?php } | |
else { ?> | |
<a href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>" title="<?php _e('Login / Register','woocommerce'); ?>"><?php _e('Login / Register','woocommerce'); ?></a> | |
<?php } ?> |
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
// the gist below will hide stuff on the frontpage in wordpress, when added to a theme template file... see https://silicondales.com/tutorials/wordpress-tutorials/code-hide-content-front-page-wordpress/ | |
<?php if( !is_front_page() ) {?> | |
// hide this stuff | |
<?php } ?> |
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
//this gist will hide Yoast breadcrumbs on the blog front page (the home page if you made this a page) | |
// see https://silicondales.com/tutorials/wordpress-tutorials/code-hide-content-front-page-wordpress/ | |
<?php if( !is_front_page() ) { | |
if ( function_exists('yoast_breadcrumb') ) { | |
yoast_breadcrumb(' | |
<p id="breadcrumbs">','</p> | |
'); | |
} | |
} | |
?> |
OlderNewer