0

How can I add custom image download button for Wordpress?

I mean when we click on download button, instantly image downloading starting without any pop up or warning.

Please help me with all required codes. Thanks...

Roamer-1888
  • 19,138
  • 5
  • 33
  • 44
user2996362
  • 49
  • 1
  • 8

3 Answers3

0

Do you want like this link updated

     <a href="#" download="image.jpg" title="ImageName">
            <img src="http://www.teluguone.com/photos/images/download_new.png" alt="ImageName">
        </a>
Community
  • 1
  • 1
Vel
  • 9,027
  • 6
  • 34
  • 66
  • I am looking for same as http://www.teluguone.com/photos/single/allu-arjun-new-look-photos-2-11079-275555.html See at bottom of image. red "download" button . Screenshot : http://i.imgur.com/87u97IK.png – user2996362 Nov 21 '15 at 14:51
0

from the formatting of your question, I'll assume that you're not too technical. To do this properly you'll need to do some work on the server, to send the file requested by the client with the correct headers.

There is a simple dom method to do it though, have a look at

http://caniuse.com/#feat=download

Though its not widely supported, it may be a viable and simple solution.

<a href="/path/to/image" download>
    <img src="/path/to/image" />
</a>

There is also a handy plugin for WordPress that will help with downloads, there may be others, but have a look at

https://wordpress.org/plugins/wp-downloadmanager/

There is also many discussion on SO here regarding this, so in the interest of brevity have a look at these if you'd like a more robust and complete solution

Example given with PHP href image link download on click

Expamle given with server config and JS Force Download an Image Using Javascript

Community
  • 1
  • 1
bigmadwolf
  • 3,419
  • 3
  • 30
  • 44
  • I am looking for same as http://www.teluguone.com/photos/single/allu-arjun-new-look-photos-2-11079-275555.html See at bottom of image. red "download" button . Screenshot : http://i.imgur.com/87u97IK.png . – user2996362 Nov 21 '15 at 14:54
  • Yes. I dont know PHP. I know only HTML , CSS . So I am asking you complete code.. – user2996362 Nov 21 '15 at 16:03
  • Then I'd recommend using either the plugin, or one similar or going with the html only option. – bigmadwolf Nov 21 '15 at 16:55
0

Download button for Featured Image in every post

1: Install the plugin Code snippets. 2: Go to Add snippets. 3: Add Your Custom Code (New Snippet). 4: Add this code and select Code Type (Php snippets). 5: And Select the Location insert after the post.

 $link= get_the_post_thumbnail_url($post_id, 'thumbnail')?>


    <a href="<?php echo $link?>"download> Downlaod </a>