Do you want a better looking Easy Digital Downloads (EDD) archive page that stands out from other pages? By default, EDD uses active theme’s default archive page template to display our EDD archive page. So our EDD archive page will look the same as posts archive page and other custom post type archive pages.
By default, we can access the URL of the EDD archive page at http://www.ourwebsite.com/downloads/. But if we change the slug of our EDD configuration like I do on this website, the URL will look like this http://www.ourwebsite.com/slug/. For example, since I have changed the slug to ‘products’, my EDD archive page URL is https://www.yudhistiramauris.com/products/.
Archive page is like default blog homepage that lists the latest blog posts. It pulls the latest downloads we add. However we can customize this using EDD
[[downloads]] shortcode. We can use attributes provided by the shortcode to filter and display the downloads list in any way we want. If you want to learn more about the shortcode and its attributes, visit the link I gave you above.
Let’s get started to create our custom EDD archive page.
First step, create a file named archive-download.php and put it inside our active theme’s root folder. If we use child theme, we need to put the file inside the child theme folder, not its parent theme. WordPress will render the custom archive page template instead of the default archive page template because WordPress has smart technology that recognizes what template that should be rendered based on its file name. It’s called template hierarchy.
After that write some codes into that file to customize our EDD archive page. On this website, I use the code below to customize my EDD archive page:
Since I use Genesis theme as my parent theme, I use Genesis action and filter hooks instead of WordPress default hooks. If you use other theme, you may use its respective hooks or WordPress default hooks.
Let’s discuss our code above. On line 3, we force the template to use full width layout instead of the default one. This filter hook is only available in Genesis.
On line 7, we remove the default Genesis loop action so that it won’t pull the latest Downloads using the regular archive page way.
On line 10, we add our custom loop function so that we can customize our EDD archive page using EDD
[[downloads]] shortcode. In our case, we have two downloads categories that we want to list as separate list on EDD archive page. So in the function
prfx_edd_downloads() above, we have two different shortcodes that group the downloads by their categories.
And finally on line 19, we have to call
genesis() function. You only have to do this if you use Genesis theme.
In summary, here are the step by step to create custom EDD archive page:
- Create a template file named archive-download.php.
- Put the file into active theme’s root folder.
- Write some codes into the file to customize the archive page.
That’s all! If you want to further customize the look of the archive page, you can use CSS.
If you have any question, don’t hesitate to ask in the form below. I will answer it as best as I can.