Allows you to wrap file links in a shortcode that will force a download when clicked.
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!
WITH 'pretty permalinks' enabled in Settings > Permalinks:
The following example would display as:
My Linkhttp://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:
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:
My Other Linkhttp://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:
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]
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]' ); ?>
/wp-content/ directory./download-shortcode/wp-content/force-download.php to your /wp-content/ directory.
Requires: 3.0 or higher
Compatible up to: 3.5.1
Last Updated: 2013-2-3
Downloads: 5,060
2 of 3 support threads in the last two months have been resolved.
Got something to say? Need help?