Last active
May 21, 2019 22:03
-
-
Save LMNTL/3a511d7d7e28868eb22d405f71e58082 to your computer and use it in GitHub Desktop.
customize the HTML/styling of links in PMPro-generated emails
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
// customize the HTML/styling of links in PMPro-generated emails | |
function my_pmpro_change_email_link_styling( $data, $email ){ | |
/*--- An array of variable names. Change or add to this to style different links. | |
default options: 'invoice_link', 'levels_link', 'login_link' ---*/ | |
$links_to_change = array( 'invoice_link', 'login_link' ); | |
$newdata = []; | |
foreach( $data as $variable => $value ) { | |
if( in_array( $variable, $links_to_change) && strpos( $value, "http" ) !== false ) { | |
/*--- Make the link color red. change this line to change the styling of the link ---*/ | |
$newdata[$variable] = '<a href="' . $data[$variable] . '" style="color:rgb(255,0,0)" !important>'.$data[$variable].'</a>'; | |
} else { | |
$newdata[$variable] = $data[$variable]; | |
} | |
} | |
return $newdata; | |
} | |
add_filter( 'pmpro_email_data', 'my_pmpro_change_email_link_styling', 30, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment