Created
April 11, 2019 18:14
-
-
Save LaurenaRehbein/ef38073ec10d36ba3911f5a08e344a05 to your computer and use it in GitHub Desktop.
A filter to change text using gettext filter. This one changes the WooCommerce/Storefront mini 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
<?php | |
/** | |
* Change the “No products in the cart” message when hovering over the mini-cart | |
* | |
*/ | |
function lar_text_strings( $translated_text, $text, $domain ) { | |
switch ( $translated_text ) { | |
case ‘No products in the cart.’ : | |
$translated_text = __( ‘new text here’, ‘woocommerce’ ); | |
break; | |
} | |
return $translated_text; | |
} | |
add_filter( ‘gettext’, ‘lar_text_strings’, 20, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment