Created
December 31, 2024 15:17
-
-
Save finalwebsites/b9695acd8fc4c3e103aa370ba2031dae to your computer and use it in GitHub Desktop.
Send WordPress emails with a template created in Maileroo
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 | |
// replace the template ID 123 with your own | |
add_filter('ssbm_add_template_data', function($payload, $atts) { | |
if ($atts['message'] == strip_tags($payload['html'])) { | |
$message = nl2br($atts['message']); | |
unset($payload['html']); | |
$payload['template_id'] = 123; | |
$payload['template_data'] = json_encode( | |
array('content' => $message) | |
); | |
} | |
return $payload; | |
}, 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This WordPress filter hook can be used to send your plain text emails in WordPress, with a stylish HTML template created in Maileroo.
To use this hook you need to install the Maileroo WordPress plugin first.
Copy this code snippet into the functions.php file from your child theme.