Skip to content

Instantly share code, notes, and snippets.

@ipokkel
Created April 1, 2021 14:26
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/a5da8e8e36102afd5637e5788f8389ee to your computer and use it in GitHub Desktop.
Save ipokkel/a5da8e8e36102afd5637e5788f8389ee to your computer and use it in GitHub Desktop.
Change or translate text for PMPro Custom Level Cost Text Add On #pmpro-level-cost-text #translate
<?php
/**
* This recipe is an example of how to change or translate
* localized text strings for PMPro Custom Level Cost Text Add On.
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*
* 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/
*/
function change_text_for_pmpro_level_cost_text( $translated_text, $text, $domain ) {
if ( 'pmpro-level-cost-text' === $domain ) {
switch ( $text ) {
case 'Free':
$translated_text = __( 'Your translation here', 'pmpro-level-cost-text' );
break;
}
}
return $translated_text;
}
add_filter( 'gettext', 'change_text_for_pmpro_level_cost_text', 20, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment