This file contains hidden or 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
function is_external_url( $url ) { | |
$link_url = parse_url( $url ); | |
$home_url = parse_url( home_url() ); | |
if ( ! empty( $link_url['host'] ) ) { | |
if ( $link_url['host'] !== $home_url['host'] ) { | |
return 'target="_blank"'; | |
} | |
} | |
} |
This file contains hidden or 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
function THEME_woocommerce_remove_shop_elements(){ | |
remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0); | |
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); | |
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 ); | |
} | |
add_action('woocommerce_before_main_content', 'THEME_woocommerce_remove_shop_elements'); | |
function THEME_woocommerce_reposition_shop_elements(){ | |
woocommerce_breadcrumb(); | |
woocommerce_result_count(); |
This file contains hidden or 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
function capri_woocommerce_add_to_cart_message( $input ) { | |
$cart_redirect = get_option( 'woocommerce_cart_redirect_after_add' ); | |
// Check for Cart page url | |
if ( function_exists( 'wc_get_page_id' ) ) { | |
$cart_url = get_permalink( wc_get_page_id( 'cart' ) ); | |
} else { | |
$cart_url = get_permalink( woocommerce_get_page_id( 'cart' ) ); | |
} |
This file contains hidden or 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
function THEMENAME_remove_product_page_sku( $enabled ) { | |
if ( ! is_admin() && is_product() ) { | |
return false; | |
} | |
return $enabled; | |
} | |
add_filter( 'wc_product_sku_enabled', 'THEMENAME_remove_product_page_sku' ); |
This file contains hidden or 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
if ( getWidth() >= 992 ) { | |
// do something | |
} | |
/* Get window width depending on the browser with JavaScript */ | |
function getWidth() { | |
if (this.innerWidth) { | |
return this.innerWidth; | |
} |
This file contains hidden or 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
/* Verify clicks outside .target-element */ | |
$('.target-element').outside('click', function() { | |
// do something | |
} | |
/* Function that detect outside clicks */ | |
(function($){ | |
$.fn.outside = function(ename, cb){ | |
return this.each(function(){ | |
var self = this; |
This file contains hidden or 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 | |
// Remove breadcrumb on shop category | |
remove_action( 'woocommerce_before_main_content','woocommerce_breadcrumb', 20, 0 ); | |
?> |
This file contains hidden or 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 | |
// Remove ordering on shop category | |
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 ); | |
?> |
This file contains hidden or 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
/** | |
* Don't forget to include FontAwesome library, version 4.7 | |
*/ | |
.social-icons li a:before { | |
font-family: FontAwesome; | |
} | |
/* Default link icon - keep this icon first */ | |
.social-icons li a[href*="http"]:before, | |
.social-icons li a[href*="#"]:before { |
This file contains hidden or 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 order for Upsell & Related products sections on single product | |
*/ | |
function CUSTOM_change_order_upsell_related() { | |
if ( is_product() ) { | |
// Remove Upsell section | |
remove_action( 'woocommerce_after_single_product_summary','woocommerce_upsell_display', 15 ); | |
// Remove Related products section |
NewerOlder