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
# Swappable Mixins in CoffeeScript | |
# ================================ | |
# Many thanks to Hashmal, who wrote this to start. | |
# https://gist.github.com/803816/aceed8fc57188c3a19ce2eccdb25acb64f2be94e | |
# Usage | |
# ----- | |
# class Derp extends Mixin |
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 cart weight in the database | |
add_action('woocommerce_checkout_update_order_meta', 'woo_add_cart_weight'); | |
function woo_add_cart_weight( $order_id ) { | |
global $woocommerce; | |
$weight = $woocommerce->cart->cart_contents_weight; | |
update_post_meta( $order_id, '_cart_weight', $weight ); | |
} |
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" | |
} |
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_filter( 'wp_head' , 'related_products_style' ); | |
function related_products_style() { | |
if( is_product() ) : | |
?> | |
<style> | |
.woocommerce .related ul.products li.product, .woocommerce .related ul li.product, .woocommerce .upsells.products ul.products li.product, .woocommerce .upsells.products ul li.product, .woocommerce-page .related ul.products li.product, .woocommerce-page .related ul li.product, .woocommerce-page .upsells.products ul.products li.product, .woocommerce-page .upsells.products ul li.product { | |
width: 24% !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
<?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
<?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
// 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 | |
/** | |
* 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
<?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() ) |
OlderNewer