Last active
April 11, 2016 21:45
-
-
Save WPDevHQ/4220d377a0e707364cd8 to your computer and use it in GitHub Desktop.
Override WooCommerce "Sale!" 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 | |
/* | |
* This function assumes you have a customizer setting of the type 'text-field' setup ready for your custom input | |
* If not then it will return the default that can be changed manually @line 11 | |
*/ | |
function themeslug_woocommerce_sale_flash( $text ) { | |
if ( get_theme_mod( 'themeslug_onsale_text' ) !='' ) { | |
$onsale = get_theme_mod( 'themeslug_onsale_text' ); | |
} else { | |
$onsale = __( 'Special Offer!', 'themeslug' ); | |
} | |
$text = '<span class="onsale">'. __( $onsale, 'themeslug' ). '</span>'; | |
return $text; | |
} | |
add_filter( 'woocommerce_sale_flash', 'themeslug_woocommerce_sale_flash' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment