Skip to content

Instantly share code, notes, and snippets.

@kimwhite
Last active April 26, 2024 17:42
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 kimwhite/2dd4f0d6dd7df72024a2a563afb81933 to your computer and use it in GitHub Desktop.
Save kimwhite/2dd4f0d6dd7df72024a2a563afb81933 to your computer and use it in GitHub Desktop.
Account Page text and links
<?php // do not copy this line.
/**
* This will allow you to alter the text and link Account Page for expired or no level users
*
* 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 my_pmpro_run_gettext_on_checkout() {
global $pmpro_pages;
if ( is_page( $pmpro_pages['account'] ) ) {
add_filter( 'gettext', 'gettext_translate_per_text_domain', 10, 3 );
}
}
add_action( 'pmpro_checkout_preheader', 'my_pmpro_run_gettext_on_checkout' );
function my_pmpro_account_page_gettext_changes( $translated, $text, $domain ) {
switch ( $domain ) {
case 'paid-memberships-pro':
switch ( $text ) {
case 'You do not have an active membership. <a href=\'%s\'>Choose a membership level.</a>';
$translated = '<a href=\'%s\'>Choose a membership level.</a>';
break;
}
break;
}
return $translated;
}
add_filter( 'gettext', 'my_pmpro_account_page_gettext_changes', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment