Easy Digital Downloads – Related Downloads Documentation

Getting Started

Installation

Easy Digital Downloads – Related Downloads is free at WordPress. To install it:

  1. Log in to your WordPress dashboard.
  2. Go to “Plugins -> Add New”
  3. Search for “Easy Digital Downloads Related Downloads”.
  4. Click to “Install Now” when you find the plugin.
  5. Activate the plugin by clicking “Activate”.

Top

Setup – Optional Settings

The EDD Related Downloads plugins works automatically without the need for any settings, so the following 7 settings are optional.

These settings are located at Downloads –> Settings –> Extensions tab.

  1. Filter by Tag or Category
    By default, downloads are related by tag. You can checkmark this option to choose to filter by category instead. This setting applies only to the related downloads that are automatically added after the single download’s content. This setting does not apply to the EDD Related Downloads widget. The widget has its own option for that, which you’ll see if you use the widget at “Appearance –> Widgets“.
  2. Show only the image
    Show only the related download image, without the title.
  3. Change the number of related items to show
    By default, 3 related items are shown. You have the option to change this number.
  4. Custom Related Downloads Title
    By default, the related items are headed by, “You May Also Like”. You have the option to enter a custom title.
  5. Disable Related Downloads From Being Added to Content
    You have the option to stop related downloads from being automatically inserted on the bottom of the single download’s content. This is useful if only want to use the sidebar widget instead.
  6. Change The Default Method of Sorting (Orderby)
    Choose what the related downloads are sorted by. Default is by “date”. You can choose to sort by:

    – date
    – ID
    – author
    – Title
    – name (post slug)
    – modified (last modified date)
    – parent
    – random
    – comment_count

  7. Change The Default Sort Order:
    Choose the whether to sort the related downloads in ascending or descending order. The default is “DESC” (descending order).

Top

Languages

Includes .mo and .po files for these languages:

  • French
  • Portuguese
  • Spanish

It also includes a .pot file so you can easily translate into other languages.

Customizing

Use Custom Images Instead of Featured Image For Related Downloads

Since version 1.4.7, there is a filter for the images used in the Related Downloads footer and sidebar widget. Sometimes your product’s featured image looks good as a large image, but is not appealing when very small.

For example, say this is your featured image for your download:

Current Planetary Positions PHP web app script

Then, this would be the thumbnail displayed as the “Related Downloads” under the heading “You May Also Like”:

Current Planetary Positions PHP web app script

That’s ugly. The new filter lets you set an image filename pattern for the plugin to detect, which makes it grab your custom “Promo image”. The result is that you can use the large image above as a featured image on the single downloads page, and yet the plugin will use this as a Related Downloads image:

Current Planetary positions WordPress plugin

In my example, I use a pattern of naming my custom promo images the download-slug followed by -promo.png. So if my download product is named “Acme Piano Sheet Music”, then my promo image will be named, acme-piano-sheet-music-promo.png

The steps involved to make this work are:

1. Decide on your pattern for naming your custom promo images. I will use download-slug-promo.png

2. Create your promo images.

3. Upload them images in your WordPress dashboard “Media –> Add New“. Leave them “Unattached.” In other words, they are not attached to any post. If your '/uploads/' folder is separated into year and month folders, then make sure you upload all of your promo images in the same month (this is for the pattern in the filter to work).

4. Use the following code in your functions.php, or other functions file, and edit the '/uploads/' path on line 8 accordingly. For example, if your '/uploads/' folder is separated into year and month folders, and you uploaded your promo images in September of 2013, then you should change '/uploads/' in line 8 to:

'/uploads/2013/09/'

And there may be many variations of this, so edit according to your own folder. If your '/uploads/' folder is not separated into years and months, then you can leave line 8 as is.

This will make the plugin use your custom images instead of the featured image. Please note, this does not check if a custom promo image exists. If the promo image does not exist, then no image will be shown. So, you must only use this filter if you are creating and uploading a promo image for each of your existing downloads!

/**
 * Custom promo images for EDD Related Downloads.
 */
function isa_related_downloads_image_src( $post ) {
	global $post;
	$prod_slug = $post->post_name;
	$promo_filename = $prod_slug . '-promo.png';
	$img_src = content_url( '/uploads/' . $promo_filename );
	return $img_src;
}
add_filter( 'edd_related_downloads_image_src', 'isa_related_downloads_image_src' ); 

Top

Show Related Downloads Using a Template Tag

Some of you don’t want the related downloads below the content, and the widget also fails to do what you want. So, you want a template tag that will let you position the related downloads anywhere on your single-download.php template.

You can accomplish this using WordPress’s function, the_widget. If you want the default output, use:

the_widget('edd_related_downloads_widget');

If you want to specify parameters for this instance, use the following. Set ‘taxcat’ to true to filter the related downloads by category. Or, set it to false to filter by tag.

$inst = array( 
        'title' => 'You May Also Like',
        'number' => 3,
        'taxcat' => false,
    );
the_widget('edd_related_downloads_widget', $inst, $args);

However, the 2 examples above will style it just like the sidebar widget, which is list-style. List-style means that the items are listed, one under each other. If you want this to appear grid-style (side-by-side), like the default related downloads that get added below the content, you have to add the $args parameter, like so (you can change the $inst, but not the $args if you want grid-style):

$inst = array( 
    'title' => 'You May Also Like',
    'number' => 3,
    'taxcat' => false,// true to filter by tag, false to filter by category
);
$args = array(
    'before_widget' => '<div id="isa-related-downloads" class="widget">',// make it grid-style
    'after_widget' => '</div>',
);
the_widget('edd_related_downloads_widget', $inst, $args);

Top

Different Size Featured Image for EDD Related Downloads

Since version 1.6.1, you can filter the image size for the Related Downloads. By default, the plugin grabs your featured image ‘thumbnail’ size. With the filter, you can designate which size to grab.

For example, if you want to grab the ‘large’ image size, use this method in your functions.php, or other functions file:

/**
 * Custom image size for EDD Related Downloads.
 */
function isa_related_downloads_image_size( $post ) {
	return 'large';
}
add_filter( 'edd_related_downloads_image_size', 'isa_related_downloads_image_size' );

You can replace ‘large’ on line 5 with ‘medium’, ‘full’, or your custom featured image size.

Additional Note
By default, the plugin’s CSS gives a max width of 150px to these images. So, although you can use this filter to grab the large or fullsize image, it will shrink (but not crop) to fit into 150px. If you want to increase the image width, add your custom CSS like this (change 150px to your desired width):

#isa-related-downloads img,
#edd-related-downloads-widget img {
    max-width: 150px;
}

Top

Fit 4 Related Products in One Line (Row)

If you’re showing 4 related downloads (instead of 3), you may want to add this CSS so that all 4 related downloads will fit in one row:

/* Fit 4 related downloads in a row */
#isa-related-downloads li,
#isa-related-downloads #edd-related-downloads-widget li {
	width: 20%;
}
#isa-related-downloads ul {
	margin:0
}
#isa-related-downloads img,
#isa-related-downloads #edd-related-downloads-widget img {
    max-width: 100%;
}

Top

Support

Please see the plugin’s FAQ before requesting support. You may find that the help you need has already been posted.

To request help or report bugs, yuu can use the official support forum for the plugin at WordPress, or ask a question below.

See the Changelog at WordPress.

Fork or contribute on GitHub.

Top

What’s New

EDD Related Downloads has been updated to version 1.7.

  • New option:
    There is a new option to show only the related download image, without the title. To enable this option, go to Downloads –> Settings –> Extensions tab, under the heading “Related Downloads Settings.”
  • Improved styling:
    Images are now aligned even if long titles are of uneven lengths. Previously, when some titles were very long, the images would be misaligned. This should now be fixed with version 1.7.

Top

Updated on March 6, 2017

We've One Response

Questions and Comments are Welcome

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this:

[code]

YOUR CODE HERE 

[/code]