Skip to main content
Easy Digital Downloads Documentation
Documentation, Reference Materials, and Tutorials for Easy Digital Downloads

How to Build Single Product Templates

At this point, it’s safe to assume you already know that
Easy Digital Downloads (EDD) was developed to work with any theme. However, there are several things that can be done to make sure your theme gets more out of EDD.

In this article, we will cover the basics of how to create single product templates for your theme. To be clear, a single product template is used to display the front-end page created when you add a new Download to your site.

WordPress Template Hierarchy

First, we have to take a step back and examine how WordPress itself works. WordPress themes are nothing more than a collection of files that work together to display your site. Some of those theme files are templates and template components that come together to create the HTML structure of your site.

WordPress uses a
template hierarchy to determined when and how to use those template files. We won’t go into full detail about the entire hierarchy, but here is a visual of how the different template files are related.

What we will cover here is the Single Post template and how it affects the way your single product pages will display. Let’s get started.

Single Post (and Singular) Template

Directly from, here is the template hierarchy for single posts:

  1. single-{post-type}-{slug}.php – (Since 4.4) First, WordPress looks for a template for the specific post. For example, if post type is product and the post slug is dmc-12, WordPress would look for single-product-dmc-12.php.
  2. single-{post-type}.php – If the post type is product, WordPress would look for single-product.php.
  3. single.php – WordPress then falls back to single.php.
  4. singular.php – Then it falls back to singular.php.
  5. index.php – Finally, as mentioned above, WordPress ultimately falls back to index.php.

What this means is that a theme file’s name tells WordPress when it should be used and its “rank” in the hierarchy for that particular use case.

The most common file name at this point is most likely
single.php. The single.php template is used to display single blog posts. As you would imagine, many users publish more blog posts on their WordPress sites than anything else. So while single.php is not the highest ranking overall, it
is the highest ranking for generic single post templates.

There is a good chance that your active theme (or parent theme, if you are using a
child theme) has a single.php file in its root folder. If so, it is used to display single blog posts. However, there is also a chance that you do not have a single.php file but instead, a singular.php file. This is becoming more common. Its basic purpose is to be more of a “universal” template for all front-end pages that fall under the WordPress “singular” definition, like blog posts, pages, and entries for basic custom post types.

Let’s cover how EDD uses these templates and how you can change that.


As mentioned above, the
single.php file is a basic template used to display single blog posts. When the URL of a blog post is visited, WordPress will search the theme structure for the appropriate template file to use for displaying that blog post. The single.php file is the common answer.

With that understanding, you also need to know that Posts (and Pages) are what WordPress calls “post types.” There are a few default post types built into WordPress but developers can also create their own, called Custom Post Types.

EDD itself introduces several custom post types to your system, one of which is the
Download. That’s the only one we are doing to discuss here.

If you scroll back up to take another look at the template hierarchy for single posts, you’ll notice that
single-{post-type}.php has a higher rank than single.php. That implies two things:

  1. If single-{post-type}.php fits the scenario, it will be used before single.php.
  2. If no single-{post-type}.php template exists, the next choice is single.php.

Unless your theme was written specifically for EDD, your situation falls under the second scenario by default. Given that EDD’s Download custom post type is registered as download, unless your theme includes a
single-download.php file (or the #1 position in the single post hierarchy, which we will not discuss), WordPress will look for the single.php file.

What this means is however your blog posts display, your EDD download will look the same. If your blog posts include byline information, post-to-post navigation, or anything else, it will also display for your downloads.

For many users, this is not a problem. For others, it can add unwanted information to the product display. Or perhaps some users simply do not want their product pages to display in the same fashion as blog posts, which is understandable.


In order to tell WordPress that you’d like to display your single product pages different from your single blog posts, you have to tap into the single post template hierarchy by creating a
single-download.php file in the root folder of your active theme (which would mean your child theme if you are using one).

Once this file is in place in the root folder of your active theme, viewing the front-end page for one of your products will call to the download-specific template instead of the blog post template. At that point, you are in control of your
single-download.php template and you can build it however you’d like.

Here’s a very useful tip for creating your
single-download.php template:

Unless you are a theme developer who already knows what you are doing, the best way to create your initial
single-download.php file is to duplicate your theme’s single.php file and then rename the duplicate to single-download.php. At that point, nothing will change about the display of your product pages. However, you are now free to edit the new template file and it will only affect your product pages.

If you are using a child theme, that means you would need to copy the parent theme’s single post template to put into the root folder of your child theme.


Things get a little more complicated here. The
singular.php file is fairly new and while it is not as widely used as the single.php file, it is still popular. As mentioned before, WordPress comes with several post types already built-in and supports the creation of custom post types. All of these post types are considered singulars.

What this means is a theme does
not have to include a single.php file, or even a page.php file (the template used for displaying WordPress Pages). If a singular.php file is present and none of the more specific templates are available, WordPress will use it for all of the post types.

Needless to say, that means this template file oftentimes has to use conditional logic. That means:

If the URL visited is a page, use this code to display the page. If the URL visited is a post, use that code to display the post.

This all happens inside of one template file. For sites with only posts and pages, this is simple. When you introduce custom post types, this can get tricky as the theme developer most likely did not create a condition for the Download custom post type, that is if the theme was not written to consider EDD.

While this is not the place to get into the details of how to build a theme, the same is true in this scenario as with overriding the
single.php for product templates. You can use the singular.php file to create (through duplication) a single-download.php file. The only difference here is that you will need to better understand the code in this file to modify it for use with products.

Single Product Templates In Summation

This is not intended to be a guide on WordPress theming. Instead, the goal is to show you how EDD works with WordPress so that you can use single product templates to display your product pages.

If you are not a WordPress theme developer, this is something you may want to outsource to someone experienced in the area. Creating the necessary file is just one step. Creating (or editing) the code in the file is a completely separate task that requires a bit of experience or at least familiarity with HTML and PHP.