Pippins Plugins
  • Email
  • Facebook
  • Feedburner
  • Github
  • Google
  • Twitter
  • Vimeo
  • Youtube
  • Rss
  • About
  • News
  • Join the Site
    • Member Benefits
    • Member Plugins
    • Email Notifications
  • Plugin Store
    • Affiliate Area
    • Checkout
  • Plugins
    • Plugin Portfolio
      • Plugin Portfolio – List View
    • Free
    • Premium
    • Member Plugins
    • Coding Standards
    • Get Plugin Support
  • Tutorials
    • Series
      • Plugin Development 101
      • Creating a User Follow System Plugin
      • Customizing Restrict Content Pro
      • Displaying Content with Easy Content Types
      • Writing Your First WordPress Plugins, Basic to Advanced
      • Working with Widgets
      • User Submitted Image Galleries
      • Plugin Thoughts
      • Integrating Stripe.com with WordPress
      • WordPress Rewrite API
    • Member Exclusive
      • Free Members
      • Subscriber Only
    • Difficulty
      • Beginner
      • Intermediate
      • Advanced
    • Action and Filter Hooks
    • Ajax
    • Custom Post Types
    • External APIs
    • Short Codes
    • Taxonomies
    • Video Tutorials
    • Widget Tutorials
    • WordPress Admin / Dashboard
    • Working with jQuery
    • WordPress Database
    • Writing Plugins
    • Tag Index
  • Reviews
  • Support Forum
  • Contact
    • Support the Site
    • Request Code Review
    • Plugin Support

How I Built the Extendable Purchase Receipt Templates in EDD

Posted on August 28, 2012 by Pippin in How It Works, Tutorials, Video Tutorials 2 Comments
Home» Tutorials » How It Works » How I Built the Extendable Purchase Receipt Templates in EDD
Tweet
Love It - 0

Easy Digital Downloads has a templating system for emailed purchase receipts that allow users / developers to create their own templates that are used for the purchase receipts. In this video overview, I want to walk you through how this system works. Building extensible modules within your plugins is something you should always strive for, and seeing how real world examples work definitely helps immensely.

To see an example of the email templates I’m referring to, take a look at the Email Templates add-on that is available.

The templating system was complex to build and has quite a few different components, but once it was complete, registering / building new templates is a piece of cake. To setup a new template, just two functions are required (with one more optional). There is one function to register the template with Easy Digital Downloads and one function to setup the HTML for the template:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// 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');
 
// create the HTML for the custom template
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');

The video above walks you through how the system that allows these two functions to work was built.

I do not expect you to gain a complete understanding of how the template system works after watching the video, or to have an immediate knowledge of how to build these kind of systems, but I do hope that seeing this gets you thinking about possible applications for your own plugins. This system is an exemplary example of an extensible module within a plugin, and that’s what I really want you to start thinking about more. Take the time to consider how you can make your own plugins more extensible and more friendly for users / developers that with to customize the behavior.

Tweet Follow @pippinsplugins
easy digital downloads

2 comments on “How I Built the Extendable Purchase Receipt Templates in EDD”

  1. samir says:
    August 28, 2012 at 3:18 pm

    can you make a wordpress theme tutorials series
    thank you very mutch your tutorials are very usefull

    Reply
    • Pippin says:
      August 28, 2012 at 4:02 pm

      No sorry, I only do plugin tutorials on this site.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Login

Lost your password?

Please enter your username or e-mail address. You will receive a new password via e-mail.

  • Facebook Become a Fan Like

  • Twitter Subscribe on Twitter Follow

  • YouTube Follow my Videos Subscribe

  • RSS Feed Subscribe with RSS Subscribe

Easy Digital Downloads

Most Loved

  • Love It Pro for WordPress
  • Write a “Love It” Plugin with Ajax to Let Users Love Their Favorite Posts / Pages
  • Simple Notices Pro Plugin for WordPress
  • User Bookmarks for WordPress
  • Front End Registration and Login Forms Plugin

Similar Plugins and Posts

  • Restrict Content Pro – Member Discounts for Easy Digital Downloads
  • Easy Digital Downloads – One Year Old
  • Easy Digital Downloads v1.5 Released
  • Crucial Security Flaw Discovered and Fixed
  • Easy Digital Downloads Giveaway

Latest Premium Content

  • Plugin Development 101 – Introduction to Adding Dashboard Menus
  • Plugin Development 101 – Intro to Loading Scripts and Styles
  • User Follow System – Part 5
  • Plugin Development 101 – Intro to Short Codes
  • Plugin Development 101 – Registering a Custom Post Type
  • Plugin Development 101 – Intro to Actions

Latest Tutorials

  • Test Your Plugins with RTL (0)

    Right-To-Left languages are those that...

  • Submitting Your First Pull Request to a WordPress Plugin on Github (5)

    Github is an extremely popular tool for managing WordPress plugins, and one...

  • Plugin Development 101 – Introduction to Adding Dashboard Menus (1)

    Adding new menus, both top level and sub level, to the WordPress Dashboard is a really common task for plugins...

Enter your email to receive automated updates when new posts are published

Latest Tweets

  • Documentation sprint now!
    May 24, 2013
  • RT @wpninjas: I think the term passive income is a misnomer. No income is truly passive. It all takes hard work and care to keep things mov…
    May 24, 2013
  • @helenhousandi My little she gets referred to as a he everytime she wears her blue WP onsie
    May 24, 2013

Topics

shortcodes featured add_options_page attachments campaign monitor meta box Rémi Corson register_setting the_content hook Tom McFarlin wp_enqueue_script contextual help do_action login Related posts authors attachment image forms mail chimp short codes plugin recent posts post types bbpress apply_filters comments short code taxonomies custom post type Ajax images gallery Stripe taxonomy jquery widgets users add_filter easy content types add_action widget restrict content pro easy digital downloads

Weekly Newsletter

Useful Links

  • Join the Site
  • Plugin Store
  • Affiliate Area
  • Tag Index
  • Support the Site
  • Suggest a Tutorial
  • Random Post
  • Contact

Monthly Archives

(c) 2013 Pippin's Plugins