Created
March 24, 2021 06:51
-
-
Save ipokkel/45ec0105d481c17dfa008647463a4806 to your computer and use it in GitHub Desktop.
Improve layout in confirmation emails sent when user checked out with PMPro Signup Shortcode set with the emailonly option. #pmpro-signup-shortcode #gettext
This file contains hidden or 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 | |
/** | |
* This recipe adds a line break after the password and email included in | |
* the confirmation email sent by PMPro Signup Shortcode when the option | |
* short is set to emailonly. | |
* | |
* To improve layout in the email you may use the Email Template Editor | |
* to change the layout of the !!user_email!! shortcode by removing the | |
* wrapping brackets. | |
* | |
* For example: | |
* In the checkout templates find: | |
* <p>Account: !!display_name!! (!!user_email!!)</p> | |
* and replace with: | |
* <p>Account: !!display_name!! !!user_email!!</p> | |
* | |
* 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/ | |
*/ | |
/** | |
* Change/Translate the text strings | |
*/ | |
function my_pmprosus_custom_email_password_string( $translated, $text, $domain ) { | |
if ( 'pmprosus' === $domain || 'pmpro-signup-shortcode' === $domain ) { | |
switch ( $text ) { | |
case 'Password: %s, Email: %s': | |
// Your custom text string or translation here. | |
$translated = '<br />Password: %s <br />Email: %s'; | |
break; | |
// in case localization gets updated with numbered placeholders in future | |
case 'Password: %1$s, Email: %2$s': | |
// Your custom text string or translation here. | |
$translated = '<br />Password: %1$s <br />Email: %2$s'; | |
break; | |
} | |
} | |
return $translated; | |
} | |
add_filter( 'gettext', 'my_pmprosus_custom_email_password_string', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment