Custom Download Templates for Easy Digital Downloads

Recently when developing a site powered by Easy Digital Downloads, I wanted one of my products to display differently from the others in the store.

When this problem arises with pages, we can easily create a page template to solve the problem. However, when it comes to creating custom templates for other items such as posts and custom post types, we need a plugin. That’s where the incredible Custom Post Template plugin by Simon Wheatley comes in. By installing the plugin you can easily create templates for your posts, but what about for downloads? Also very easy due to the extensible nature of the Custom Post Template plugin.

Firstly, you’ll need to install the Custom Post Template plugin on your site.

You then need to add the following to your functions.php:

https://gist.github.com/bryceadams/3843548.js

You’ll now see a Custom Post Template metabox on the right side of the edit screen for Downloads. It’s now time to create the actual download template files. Make a copy of single-download.php and rename it whatever you’d like. You then need to add the following few lines to the beginning of the file, just like you would for a page template:

https://gist.github.com/bryceadams/3843580.js

That downloads metabox will now be filled with all the custom download templates you create! For me this came in handy where I had a download that I wanted to offer for free but also didn’t want to force users to go through the checkout process just to get their copy. By creating a custom download template, I was able to turn the ‘Buy’ button into a ‘Download’ button that linked straight to the file.

One thought on “Custom Download Templates for Easy Digital Downloads

  1. Thank you, thank you, thank you! EDD is a great plugin, but I had two problems:
    1) To prevent a specific download from appearing in the download archives page. I found a plugin from EDD to take care of that.
    2) The ability to use custom templates. You’ve just solve this for me.
    Thanks again.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s