Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save strangerstudios/0ff19daaee3bcfc76b441982c1c6645e to your computer and use it in GitHub Desktop.
Save strangerstudios/0ff19daaee3bcfc76b441982c1c6645e to your computer and use it in GitHub Desktop.
Example of using the gettext filter to change some address-related strings in PMPro.
/*
Replace some address-related strings in PMPro.
Add this code to a custom plugin.
*/
function gettext_pmpro_checkout_city_state_postcode($translated_text, $original_text, $domain) {
if($domain == 'pmpro' || $domain == 'paid-memberships-pro') {
if($translated_text == 'City, State Zip')
$translated_text = 'City, County, Post Code';
if($translated_text == 'State')
$translated_text = 'County';
if($translated_text == 'Zip' || $translated_text == 'Zipcode')
$translated_text = 'Post Code';
}
return $translated_text;
}
add_filter('gettext', 'gettext_pmpro_checkout_city_state_postcode', 10, 3);
@paulotruta
Copy link

I'm using this technique to override strings sucessfully in the theme textdomain, but somehow when trying to override some original strings for the "Formidable Forms" plugin, it is just not working... Any suggestions on this? ;)

@pbrocks
Copy link

pbrocks commented May 15, 2018

@paulotruta 'Formidable Forms' will have a different domain. Change that and it should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment