i have attacment.php like this.
<?php
if ( $attachments = get_children( array(
'post_type' => 'attachment',
'post_mime_type'=>'image',
'numberposts' => 1,
'post_status' => null,
'post_parent' => $post->ID
)));
foreach ($attachments as $attachment) {
echo wp_get_attachment_link( $attachment->ID, '' , false, true, 'Download This Wallpaper');
}
?>
this code will print attachment link.
My question is: How to make this link to be single click to download image and save to computer user?
It is possible by using the plugin:
http://wordpress.org/extend/plugins/download-shortcode/
I am here to assist you since I am using the same functionnality in my website (force dowloading of post attachements)
Although it is not WP-specific, here’s how to force the user to download an image:
Note: the code is untested.
Save the following as
image.php
on your theme: