Download Category and Tag Templates
While Easy Digital Downloads (EDD) is designed to work with any theme, there are several things you can do to your theme to take advantage of EDD’s flexibility.
In other articles, we’ve discussed how to do things like
create theme templates specifically for product pages as well as editing the downloads archive. Here, we’ll discuss how to take control of the category and tag display for your products.
Download Taxonomy Archives
WordPress uses its template hierarchy to determine which theme template file should be used to display any given page on your site. For taxonomies, or download categories and tags in this context, the template hierarchy is as follows:
taxonomy-{taxonomy}-{term}.php
– If the taxonomy issometax
, and taxonomy’s term issometerm
, WordPress will look fortaxonomy-sometax-someterm.php.
In the case of post formats, the taxonomy is ‘post_format’ and the terms are ‘post-format-{format}. i.e.taxonomy-post_format-post-format-link.php
for the link post format.taxonomy-{taxonomy}.php
– If the taxonomy weresometax
, WordPress would look fortaxonomy-sometax.php
.taxonomy.php
archive.php
index.php
This hierarchy is oftentimes neglected in themes, not because it is unimportant, but because the
archive.php
template file is considered a standard and is usually present. On a non-eCommerce site, not too many structural changes are required from a typical date archive display to a post archive display.
However, EDD categories and tags are in the same position as the downloads archive covered in the second article linked above. They are not intended to display like typical WordPress posts, but instead like the products that they are.
That said, you have the ability to take control of the download category and tag templates by creating certain files in the root of your active theme.
taxonomy-download_category.php – taxonomy-download_tag.php
Based on the template hierarchy mentioned above, controlling EDD’s category and tag display would fall under the #2 position. In the WordPress system, a Download category is
download_category
and a Download tag is download_tag
.
So
taxonomy-{taxonomy}.php
is the template naming scheme that WordPress would use to search for template specific to EDD’s Downloads.
If you place files called
taxonomy-download_category.php
and taxonomy-download_tag.php
in the root of your active theme, WordPress will use those to render your Download categories and tags. What you build into these files is up to you.
If you are a theme developer, you should be familiar with how to build the various template files. You can use our
sample product grid to jumpstart the development of your download category and tag templates. If you are not a theme developer, this is something you would need to hire someone for. How to develop these taxonomy archives is less about EDD and more about WordPress and general development. That is outside the scope of this documentation.
If you are not a theme developer but you are hands-on, there are several theme examples you can use to grasp the concept of creating download category and tag archives for your theme. The best reference would be our
Vendd theme, which you can also find on GitHub for easy access to the codebase.