Skip to content

Instantly share code, notes, and snippets.

@WPDevHQ
Last active April 11, 2016 21:45
Show Gist options
  • Save WPDevHQ/4220d377a0e707364cd8 to your computer and use it in GitHub Desktop.
Save WPDevHQ/4220d377a0e707364cd8 to your computer and use it in GitHub Desktop.
Override WooCommerce "Sale!" text
<?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