Created
March 4, 2020 19:30
-
-
Save hedqvist/c8c3a3638578611e5663a4a4ec098b5d to your computer and use it in GitHub Desktop.
Translate anything
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 | |
| /** | |
| * @snippet WooCommerce - Translate any text :) | |
| * @author Redlight Media AB / Christopher Hedqvist | |
| * @compatible WooCommerce 3.9.2 | |
| */ | |
| add_filter('gettext', 'translate_myText'); | |
| add_filter('ngettext', 'translate_myText'); | |
| function translate_myText($translated) { | |
| $translated = str_ireplace('myTextToReplace', 'myNewText', $translated); | |
| return $translated; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment