You can easily output a list or grid of downloadable products using the [downloads] short code. This short code accepts a variety of parameters that allow you to specify what downloads are displayed, and how they are displayed.
To show downloads with the default configuration, use this:
This will output the downloads in a three column grid with thumbnails (if present), a 30 word excerpt, and a purchase button that says "Add to Cart".
If you wish to modify this output, here is a list of the parameters:
Both the category and tags parameters accept a comma separated list IDs. For example:
[downloads category="7,15" tags="16,17"]
You can find a category's ID by going to Dashboard → Downloads → Categories, then click "edit" below the category in question. On the page that loads, look at the URL in the address bar and find "tag_ID=". The number after it is the category ID.
Use the same process to find a tag ID by going to Dashboard → Downloads → Tags.
The exclude_category and exclude_tags parameters are used to prevent downloads with specific categories or tags from being displayed. Use a comma separated list of IDs for each.
The order parameter accepts either "DESC" or "ASC".
The orderby parameter accepts the following options:
- post_date (default)
The number and columns parameters accept a numerical value. Specify the maximum number of downloads you want to outputted by the shortcode, as well as the number of columns. For example:
[downloads number="15" columns="3"]
The relation option is for specifying whether the downloads displayed have to be in ALL the categories/tags provided, or just in at least one. Use "AND" for showing downloads that are filed in every category/tag (very specific), and use "OR" for showing downloads filed in any of the given categories / tags. Leave both of these blank to show all downloads.
Price, excerpt, full_content and buy_button accept "yes" or "no".
The thumbnails parameter requires "true" or "false".
The ids parameter accepts specific download IDs. You can specify multiple download IDs using comma separated values. For example:
[downloads category="14,15" number="10" columns="2"]
Customizing the output programatically in your child theme:
It is possible to customize the content that is output by the [downloads] shortcode by moving templates files into your child theme's folder. Specifically, you'll likely want to move the template file called "shortcode-download.php", or one of its child files into your child theme's folder. To do this, follow the guide in this doc. Note that doing this requires advanced WordPress theme coding knowledge. If you require assistance with this, we have a consultants page with professionals available for hire for custom code-related jobs like this.