Skip to content

Instantly share code, notes, and snippets.

@ipokkel
Created October 9, 2020 15:33
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 ipokkel/b61e2afbcf5945583dfe15f61738b5ab to your computer and use it in GitHub Desktop.
Save ipokkel/b61e2afbcf5945583dfe15f61738b5ab to your computer and use it in GitHub Desktop.
This recipe is an example of how to change and translate localized text strings for PMPro.
<?php
/**
* This recipe is an example of how to change and translate localized text strings
* for PMPro.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
/**
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function my_pmpro_text_strings( $translated_text, $text, $domain ) {
switch ( $text ) {
case 'Country':
/* translators: a title above the login input field */
$translated_text = __( 'Your Translation Here', 'paid-memberships-pro' );
break;
case 'Email Address':
$translated_text = __( 'Your Translation Here', 'paid-memberships-pro' );
break;
case 'Confirm Email':
$translated_text = __( 'Your Translation Here', 'paid-memberships-pro' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'my_pmpro_text_strings', 20, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment