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.
Chris says
Thanks, Mauris for the great code. It works perfectly. I’m now trying to space the EDD content horizontally across the page using CSS via PHP. I.e. thumbnail, title, price, purchase button, play button. I am struggling with wrapping – $prfx_edd .= do_shortcode in a . Any pointers would be much appreciated.
Mauris says
You’re welcome Chris. I’m glad it helped.
May I look at your code? You can insert CSS directly in PHP code like this:
Chris says
Thanks, Mauris. I received a Wordfence error inserting the code, so I pasted a link below.
https://github.com/ChrisE10/Code-Snippets.git
Filename “Genesis display product loop.”
Thanks in advance for the help?
Mauris says
Please try this code. I updated it from your code.
Chris says
Thanks again for the help the code worked great. Here’s a link to the final version
https://github.com/ChrisE10/Code-Snippets.git
Can I contact you in the next few weeks regarding some further dev work?
Mauris says
You’re welcome Chris! Sure, you can contact me via form on this page: https://www.yudhistiramauris.com/services/.
Santoo says
Hi, thanks for the gr8 insights. I need your help – how do I change the EDD download page (archive.php) to a normal page in genesis. I have also created a page like mywebsite.com/download on which I need the download page of EDD to be.
I can use the shortcode to add downloads and do the required changes in the page section.
Please let me know.
Mauris says
I think the easiest way is you just need to add the shortcode on the created page, and then redirect your archive page to the created page.