Created
March 15, 2017 20:02
-
-
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.
This file contains 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
/* | |
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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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? ;)