Allows you to wrap file links in a shortcode that will force a download when clicked
| Author: | Drew Jaynes (DrewAPicture) (profile at wordpress.org) |
| WordPress version required: | 3.0 |
| WordPress version tested: | 4.2.0 |
| Plugin version: | 1.1 |
| Added to WordPress repository: | 29-07-2012 |
| Last updated: | 21-04-2015
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
|
| Rating, %: | 90 |
| Rated by: | 11 |
| Plugin URI: | http://www.werdswords.com |
| Total downloads: | 17 330 |
![]() Click to start download |
|
Have you ever linked a PDF, an mp3, image, or other kind of file because you wanted to let people download it but instead it just loads in the browser? This plugin introduces a [download] shortcode which allows you to output links that will tell the browser to download those files!
Usage
WITH 'pretty permalinks' enabled in Settings > Permalinks:
The following example would display as:
- A link titled
My Link - With a rewritten URL of
http://yoursite.com/download/my_song.mp3
[download label="My Link"]http://yoursite.com/wp-content/uploads/my_song.mp3[/download]
The following example would display as:
- A rewritten link titled
http://yoursite.com/download/my_song.mp3
[download]http://yoursite.com/wp-content/uploads/my_song.mp3[/download]
WITHOUT 'pretty permalinks' enabled in Settings > Permalinks:
The following example would display as:
- A link titled
My Other Link - With an exposed URL of
http://yoursite.com/wp-content/force-download.php?file=uploads/my_other_song.mp3
[download label="My Other Link"]http://yoursite.com/wp-content/uploads/my_other_song.mp3[/download]
The following example would display as:
- An exposed link titled
http://yoursite.com/wp-content/force-download.php?file=uploads/my_other_song.mp3
[download]http://yoursite.com/wp-content/uploads/my_other_song.mp3[/download]
Other Uses
If you wanted to use this in a php template, you could call something like:
<?php echo do_shortcode( '[download label="My Label"]http://example.com/wp-content/uploads/my_song.mp3[/download]' ); ?>
Important notes:
- If your server permissions allow it, the plugin will automatically attempt to copy force-download.php to your
/wp-content/directory. - If your server permissions DO NOT allow it, you will need to manually upload the file located in
/download-shortcode/wp-content/force-download.phpto your/wp-content/directory. - By default, forced-download links only support files located in your uploads directory. More about this in Other Notes.
