Learn in this tutorial how to customize the way Easy Digital Downloads (EDD) download history is displayed using code.
If you are using the
[download_history] shortcode of Easy Digital Downloads to display the download history to the user, you will have noticed that the design is quite simple.
This austere design may be sufficient for displaying a list of download links, but you may want to display something more visually appealing.
For example, something like this:
Interested? Here’s how you can get it:
Steps to customize how Easy Digital Downloads download history is displayed
1. Create a history-downloads.php file
First of all, create a folder called edd_templates in the root of your theme. Then create inside it a file called history-downloads.php with the following code.
In this case, the structure has the following elements:
- Featured image (
get_the_post_thumbnail ( $product_id, 'medium' ))
- Title (
$title = $download->post_title;)
- Excerpt (
$excerpt = $download->post_excerpt;)
- Author (
$author_id = $download->post_author;)
- Button with link to download (or to content if there is no download)
The featured image will be displayed in WordPress
medium size which by default is 300 x 300 pixels, but you can also use other sizes from plugins or themes.
It is also intended to show the author/creator with a link to the rest of the content created by the same.
And it will show a “Download” button in the EDD products that have a file or a “View” button if they don’t have one.
This is just an example so you can modify it to your liking.
Note that this tutorial has been updated to be compatible with Easy Digital Downloads version 3.0 and above.
2. Customize the styles
Once you have created the structure you are interested in, you only need to apply the CSS styles. To do this, add the following lines to the end of the style.css file:
As with the elements you want to display, the idea is that you customize the design to your liking.
Do you want to customize the way Easy Digital Downloads download history is displayed? Now you know how to do it using code.
If you have any question, please leave it in the comments. And if you want to give me a suggestion for future snippets, please send it through the contact form.
Benefits of being a subscriber. 🙂