X

How to Create Custom Email Templates for Easy Digital Downloads

Snippets by IsItWP

Are you looking for a way to create custom email templates to give a consistent brand look to your emails? While there’s probably a plugin for this, we have created a quick code snippet that you can use to create custom email templates for Easy Digital Downloads.

Instructions:

All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:

function pw_edd_custom_email_template() {	
 
	echo '<div style="width: 550px; border: 1px solid #1e79c0; background: #ddd; padding: 8px 10px; margin: 0 auto;">';
		echo '<div id="edd-email-content" style="background: #f0f0f0; border: 1px solid #9ac7e1; padding: 10px;">';
			echo '{email}'; // this tag is required in order for the contents of the email to be shown
		echo '</div>';	
	echo '</div>';
 
}
add_action('edd_email_template_my_custom_template', 'pw_edd_custom_email_template');
 
// register the custom email template
function pw_edd_get_email_templates( $templates ) {
 
	$templates['my_custom_template'] = 'My Custom Template Name';
 
	return $templates;
}
add_filter('edd_email_templates', 'pw_edd_get_email_templates');

Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.

If you liked this code snippet, please consider checking out our other articles on the site like: 9 best WordPress auction plugins to build the next eBay and how to save partial form data in WordPress.

Comments   Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!