Created
November 4, 2020 10:37
-
-
Save onemanparsons/2b8749fe28ef5a8bc72192aaa0792161 to your computer and use it in GitHub Desktop.
Use in child theme's functions.php. Useful to translate a handful of strings. For more extensive translations a plugin like Loco Translate comes in handy.
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
// Theme translations | |
function custom_text_translate($translated) { | |
switch ( $translated ) { | |
case 'The Shop' : | |
$translated = 'Donate'; | |
break; | |
case 'Welcome to our online store. Take some time to browse through our items.' : | |
$translated = 'Welcome to our donations hub.'; | |
break; | |
} | |
return $translated; | |
} | |
add_filter('gettext', 'custom_text_translate' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment