Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pbrocks/ded5e445b452e6e69b869e27e043f77a to your computer and use it in GitHub Desktop.
Save pbrocks/ded5e445b452e6e69b869e27e043f77a to your computer and use it in GitHub Desktop.
Paid Memberships Pro allows for custom functionality to be added to the email templates add on by checking for templates in other places. This recipe adds a path to your custom plugin and alerts PMPro to check for the folder you've created in your plugin.
<?php
/**
* Create a folder in your Customizations plugin called 'email'.
* Alert PMPro to check the folder in this plugin for PMPro email templates.
*
* Custom Function to create a new path for PMPro to check for email templates.
*
* @param array $default_templates Pull in existing email templates
*
* @return array Return the list which now includes yours
*/
function pmpro_email_templates_in_customizations_plugin( $default_templates ) {
$default_templates[] = dirname( __FILE__ ) . '/email/';
return $default_templates;
}
add_filter( 'pmpro_email_custom_template_path', 'pmpro_email_templates_in_customizations_plugin' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment