How to change just one language string
If you only want to change one language string, you can add a PHP code snippet, instead of creating or editing language files.
We recommend using the Code Snippets plugin.
You will need:
- text domain: this is usually the file name of the language file, for example geodirectory, geodirlocation etc
- exact default string: it is best to copy this direct from the language file in the .po file in the language file
Example code snippet 1
add_filter( 'gettext', '_my_string_changes', 10, 3); function _my_string_changes($translation, $text, $domain ){ if( $domain == 'geodirectory' && $text == 'Post received, your listing may need to be reviewed before going live, you can preview it %shere%s.' ){ $translation = 'Thanks for adding a listing this will be approved within 24 hours.'; } return $translation; }
Example code snippet 2
add_filter( 'gettext', '_my_string_changes', 10, 3); function _my_string_changes($translation, $text, $domain ){ if( $domain == 'geodirlocation' && $text == 'Click on above field and type to filter list or add a new city.' ){ $translation = 'Select a city or town.'; } return $translation; }