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 | |
//* Do NOT include the opening php tag | |
//* Enqueue Lato Google font | |
add_action( 'wp_enqueue_scripts', 'sp_load_google_fonts' ); | |
function sp_load_google_fonts() { | |
wp_enqueue_style( 'google-font-lato', '//fonts.googleapis.com/css?family=Lato:300,700', array(), CHILD_THEME_VERSION ); | |
} |
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 | |
// Use WC 2.0 variable price format, now include sale price strikeout | |
add_filter( 'woocommerce_variable_sale_price_html', 'wc_wc20_variation_price_format', 10, 2 ); | |
add_filter( 'woocommerce_variable_price_html', 'wc_wc20_variation_price_format', 10, 2 ); | |
function wc_wc20_variation_price_format( $price, $product ) { | |
// Main Price | |
$prices = array( $product->get_variation_price( 'min', true ), $product->get_variation_price( 'max', true ) ); | |
$price = $prices[0] !== $prices[1] ? sprintf( __( 'From: %1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] ); | |
// Sale Price | |
$prices = array( $product->get_variation_regular_price( 'min', true ), $product->get_variation_regular_price( 'max', 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
<?php | |
/** | |
* Add login link to my account menu. | |
* | |
* Add this to your theme functions file | |
*/ | |
add_filter( 'wp_nav_menu_items', 'woocommerce_nav_menu_items_login', 10, 2 ); | |
function woocommerce_nav_menu_items_login( $items, $args ) { | |
if ( get_option('woocommerce_menu_logout_link')=='yes' && strstr($items, get_permalink(woocommerce_get_page_id('myaccount'))) && !is_user_logged_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
<?php | |
/** | |
* Change In Stock / Out of Stock Text | |
*/ | |
add_filter( 'woocommerce_get_availability', 'wcs_custom_get_availability', 1, 2); | |
function wcs_custom_get_availability( $availability, $_product ) { | |
// Change In Stock Text |
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
// Remove the product rating display on product loops | |
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 ); |
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( 'genesis_after_header', 'be_change_sidebar_order' ); | |
/** | |
* Swap Primary and Secondary Sidebars on Sidebar-Sidebar-Content | |
* | |
* @author Bill Erickson | |
* @link http://www.billerickson.net/switch-genesis-sidebars/ | |
*/ | |
function be_change_sidebar_order() { |
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 | |
//* Do NOT include the opening php tag | |
add_filter( 'body_class', 'sk_body_class' ); | |
/** | |
* Add "inner" class to 'body' element for inner pages | |
* i.e., for all pages other than site's homepage/front page. | |
* | |
* @author Sridhar Katakam | |
* @link http://sridharkatakam.com/add-inner-body-class-inner-pages-wordpress/ |
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_email_after_order_table', 'add_payment_method_to_admin_new_order', 15, 2 ); | |
/** | |
* Add used coupons to the order confirmation email | |
* | |
*/ | |
function add_payment_method_to_admin_new_order( $order, $is_admin_email ) { | |
if ( $is_admin_email ) { | |
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 | |
/** | |
* Store terms and conditions value within the database | |
**/ | |
add_action('woocommerce_checkout_update_order_meta', 'woo_save_terms_and_conditions_status'); | |
function woo_save_terms_and_conditions_status( $order_id ) { | |
if ($_POST['terms']) update_post_meta( $order_id, '_terms', esc_attr($_POST['terms'])); | |
} |
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 woocommerce_custom_subscription_product_single_add_to_cart_text( $text = '' , $post = '' ) { | |
global $product; | |
if ( $product->is_type( 'subscription' ) ) { | |
$text = get_option( WC_Subscriptions_Admin::$option_prefix . '_add_to_cart_button_text', __( 'Sign Up Now', 'woocommerce-subscriptions' ) ); | |
} else { | |
$text = $product->add_to_cart_text(); // translated "Read More" | |
} |