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
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:
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.