Last active
December 20, 2015 13:09
-
-
Save bhays/6136951 to your computer and use it in GitHub Desktop.
Translate selected strings in WordPress. Originally from http://www.viper007bond.com/2011/07/13/changing-core-wordpress-strings/
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
// Translate theme strings | |
function mytranslate_filter_gettext( $translated, $original, $domain ) { | |
// Array of original strings and what they should be replaced with | |
$strings = array( | |
'Contribute Now' => 'Donate Now', | |
); | |
if ( isset( $strings[$original] ) ) { | |
$translations = &get_translations_for_domain( $domain ); | |
$translated = $translations->translate( $strings[$original] ); | |
} | |
return $translated; | |
} | |
add_filter( 'gettext', 'mytranslate_filter_gettext', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment