Last active
April 26, 2024 17:42
-
-
Save kimwhite/2dd4f0d6dd7df72024a2a563afb81933 to your computer and use it in GitHub Desktop.
Account Page text and links
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
<?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