Last active
September 9, 2021 07:44
-
-
Save andrewlimaza/e67dc3c00cb8a5c1b07b7d39caca2174 to your computer and use it in GitHub Desktop.
Overwrite email templates inside Paid Memberships Pro by adding HTML templates to theme directory.
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 | |
/** | |
* Overwrite email templates from child theme HTML templates. | |
* Create html templates in your child theme under paid-memberships-pro/email/ | |
* Add this code to your site by following this guide - | |
*/ | |
function cg_pmpro_load_from_theme_template( $body, $email ) { | |
if ( file_exists( get_stylesheet_directory() . '/paid-memberships-pro/email/' . $email->template . '.html' ) ) { | |
$body = file_get_contents( get_stylesheet_directory() . '/paid-memberships-pro/email/' . $email->template . '.html' ); | |
} | |
return $body; | |
} | |
add_filter( 'pmpro_email_body', 'cg_pmpro_load_from_theme_template', 15, 2 ); |
Thanks, I've updated the code. Sorry I missed that.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello Andrew, thanks for this hook, anyway it cannot works ...
about $body need to get the content instead of the directory, it may be:
This works. Thanks