Template Files for Download Product Pages

Easy Digital Downloads is designed to work right out of the box with most WordPress themes. It does this by using a template hierarchy system in the same way WordPress does.

When you create a new product in EDD and view the front-end page, chances are it will display just like a single blog post in your theme. That's because EDD will use the  single.php template file in your theme to display the download page.

For many themes, that is perfectly fine. For others, not so much. The good news is you're not stuck with it. You can create a template file used only by EDD's single downloads.

EDD only uses the  single.php template because it can't find the one it's looking for: single-download.php. If that template file exists, EDD will use it to display single downloads instead of the template for blog posts.

To create your  single-download.php template, copy the single.php from the root of your parent them into the root of you active [child] theme. Then rename the file single-download.php.

Note: Just like that, this template is now in use for your single download pages. To confirm, make a small edit to that file, save, and view a download page on the front end of your site to see the change.

The reason you want to copy the template for blog posts is because it gives you a starting point that you can tweak to your needs.

Common Adjustments for Download Templates

* To prevent being locked out of your site because of a code error, please consider making the following edits through FTP and a file editor instead of your WordPress dashboard.

Remove Sidebar

The  single.php template will oftentimes include a call to the sidebar which can easily be removed if you'd like to limit distractions on your product pages. Most sidebars are called using the `get_sidebar()` function.

Display Download Categories & Tags

It's very common for themes to display category and tag information on single blog posts. Unfortunately, the code used to display that information is not the same for single downloads.

If you'd like to display categories and tags on single downloads, remove any category/tag code left over for single posts and use the following code (tweak to your needs):

Categories:

// display download categories
the_terms( $post->ID, 'download_category', 'Categories: ', ', ', '' );

Tags:

// display download tags
the_terms( $post->ID, 'download_tag', 'Tags: ', ', ', '' );

Template Parts (advanced)

It's very possible that your WordPress theme uses the  get_template_part() function inside of template files for better file organization. This function allows theme developers to take a portion of a template file and place it in another file.

If the  single.php file you copied uses get_template_part() to remove part of the single post HTML into another file, your new single-download.php file will do the same. Use the parameters in the function to find which file holds this HTML.

Ex.  get_template_part( 'content', 'single' ) refers to content-single.php.

The code in this file (typically just the HTML, not the opening PHP tag at the top of the file) can be copied and pasted in place of the  <?php get_template_part(); ?> call from your single-download.php file. That way you have all of the template to play with as you design your single download page.

Frameworks & Special Themes

There's always a chance your WordPress theme does not use the standard structure which makes this process a bit complicated.

Many frameworks do not use a  single.php template file at all. Instead, they use maybe just one template file that follows a chain of code through multiple files to build a template structure.

If that's the case with your framework, first understand that if your framework supports child themes, you can still create a  single-download.php file in the root of your child theme and EDD will use it. However, you just won't have much of a structure to start with unless you understand the framework well enough to mimic its structure.

If your framework or special theme does not support child themes, your best bet is to see if the theme support community has already created a solution for integrating with EDD.

Chances are your single downloads will display just fine as they will use whatever structure is already created for single blog posts. It's creating a custom single download page where things get complicated.