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...
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...
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>
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
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>