Skip to content

Instantly share code, notes, and snippets.

@timersys
Last active June 11, 2016 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timersys/d242f283ecdb49f8a25a4128efe0c0aa to your computer and use it in GitHub Desktop.
Save timersys/d242f283ecdb49f8a25a4128efe0c0aa to your computer and use it in GitHub Desktop.
Custom email templates for WordPress Plugin
<?php
/**
* Custom Email Template
*
* @wordpress-plugin
* Plugin Name: Custom Email Template
* Plugin URI: http://wordpress.org/plugins/email-templates
* Description: Custom template for Email templates plugin
* Version: 1.0.0
* Author: Damian Logghe
* Author URI: https://timersys.com
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
define( 'CUSTOM_MAILTPL_PLUGIN_FILE' , __FILE__);
define( 'CUSTOM_MAILTPL_PLUGIN_DIR' , plugin_dir_path(__FILE__) );
define( 'CUSTOM_MAILTPL_PLUGIN_URL' , plugin_dir_url(__FILE__) );
/**
* Replace original template with our custom one
*/
add_filter('mailtpl/customizer_template', 'custom_mailtpl_template');
function custom_mailtpl_template( $template ) {
return CUSTOM_MAILTPL_PLUGIN_DIR . "/templates/default.php";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment