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('woocommerce_product_single_add_to_cart_text', 'woocommerce_custom_add_to_cart_text'); | |
function woocommerce_custom_add_to_cart_text() { | |
return __("That's My Jam!", 'woocommerce'); | |
} | |
/** https://avada.io/woocommerce/docs/change-add-to-cart-button-text.html **/ |
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('template_redirect', 'my_custom_disable_author_page'); | |
function my_custom_disable_author_page() { | |
global $wp_query; | |
if ( is_author() ) { | |
// Redirect to homepage, set status to 301 permenant redirect. | |
// Function defaults to 302 temporary redirect. | |
wp_redirect(get_option('home'), 301); | |
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( 'wp_trim_excerpt', 'tu_excerpt_metabox_more' ); | |
function tu_excerpt_metabox_more( $excerpt ) { | |
$output = $excerpt; | |
if ( has_excerpt() ) { | |
$output = sprintf( '%1$s <p class="read-more-container"><a class="ast-button" href="%2$s">Read more</a></p>', | |
$excerpt, | |
get_permalink() | |
); | |
} |
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( 'woocommerce_price_trim_zeros', '__return_true' ); | |
/** https://krokedil.com/dont-display-prices-with-0-decimals-in-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
add_filter( 'woocommerce_product_add_to_cart_text', 'product_cat_add_to_cart_button_text', 20, 1 ); | |
function product_cat_add_to_cart_button_text( $text ) { | |
// Only for a specific product category | |
if( has_term( array('gift-pack'), 'product_cat' ) ) | |
$text = __( 'Yes! The Perfect Gift!', 'woocommerce' ); | |
return $text; | |
} | |
add_filter( 'woocommerce_product_single_add_to_cart_text', 'product_cat_single_add_to_cart_button_text', 20, 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
/** | |
* Hide shipping rates when free shipping is available, but keep "Local Pickup Plus" | |
* Updated to support WooCommerce 2.6 Shipping Zones | |
*/ | |
function hide_shipping_when_free_is_available( $rates, $package ) { | |
$new_rates = array(); | |
foreach ( $rates as $rate_id => $rate ) { | |
// Only modify rates if free_shipping is present. | |
if ( 'free_shipping' === $rate->method_id ) { |
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('get_the_archive_title', function ($title) { | |
return preg_replace('/^\w+: /', '', $title); | |
}); | |
/** https://wordpress.stackexchange.com/questions/175884/how-to-customize-the-archive-title **/ |
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( 'jetpack_psh_active', '__return_false' ); | |
/** https://jetpack.com/support/feature-hints/ **/ |
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( 'woocommerce_cart_subtotal', 'bbloomer_slash_cart_subtotal_if_discount', 99, 3 ); | |
function bbloomer_slash_cart_subtotal_if_discount( $cart_subtotal, $compound, $obj ){ | |
global $woocommerce; | |
if ( $woocommerce->cart->get_cart_discount_total() <> 0 ) { | |
$new_cart_subtotal = wc_price( WC()->cart->subtotal - $woocommerce->cart->get_cart_discount_tax_total() - $woocommerce->cart->get_cart_discount_total() ); | |
$cart_subtotal = sprintf( '<del>%s</del> <b>%s</b>', $cart_subtotal , $new_cart_subtotal ); | |
} | |
return $cart_subtotal; | |
} |
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( 'gettext', 'bbloomer_translate_woocommerce_strings', 999, 3 ); | |
function bbloomer_translate_woocommerce_strings( $translated, $untranslated, $domain ) { | |
if ( ! is_admin() && 'woocommerce' === $domain ) { | |
switch ( $translated ) { | |
case 'You may be interested in…': | |