Skip to content

Instantly share code, notes, and snippets.

@evrpress
evrpress / gist:eda7d379b9342663138c
Created Feb 23, 2016
Add custom header to MyMail
View gist:eda7d379b9342663138c
function add_custom_header_to_mymail($obj){
$obj->add_header('X-Custom-Header', 'Custom Value');
}
add_action('mymail_presend', 'add_custom_header_to_mymail');
@evrpress
evrpress / gist:c2cc116114299a9ea79d
Last active Aug 7, 2016
Uppercase first and lastname
View gist:c2cc116114299a9ea79d
function my_uppercase_name( $data ) {
if(isset($data['firstname'])) $data['firstname'] = ucwords($data['firstname']);
if(isset($data['lastname'])) $data['lastname'] = ucwords($data['lastname']);
return $data;
}
add_filter( 'mymail_verify_subscriber', 'my_uppercase_name' );
@evrpress
evrpress / dynamic_tag.php
Last active Jan 20, 2016
Dynamic tags with option example
View dynamic_tag.php
if ( function_exists( 'mymail_add_tag' ) ) {
function mytag_function($option, $fallback, $campaignID = NULL, $subscriberID = NULL){
if(1 == $option){
$link = 'http://exmaple.com/link1';
}else if(2 == $option){
$link = 'http://exmaple.com/link2';
}else if(3 == $option){
$link = 'http://exmaple.com/link3';
}
@evrpress
evrpress / gist:c57da52a3848305524e8
Last active Jan 13, 2016
Replacing certain strings
View gist:c57da52a3848305524e8
function my_mymail_text_strings( $translated_text, $org_text, $domain ) {
if($domain != 'mymail') return $translated_text;
switch ( $org_text ) {
case 'Search for Text to Replace' :
$translated_text = 'Replace it with this text';
break;
}
return $translated_text;
}