Add download funtionality to Royal PrettyPhoto plugin


A way to extend Royal prettyPhoto plugin to support download image functionality is via Javascript.

Just put the following lines into the functions.php of your theme file.

add_action('wp_footer','ls_prettyPhoto_Download');
/**
 * Adds download functionality to prettyPhoto plugin
 * @author lenasterg
 */
function ls_prettyPhoto_Download() {
 echo '<style>.pp_download{ background: #ccc; border-radius: 3px; height: 25px; padding: 4px;}</style>


jQuery(document).ready(function() {
 jQuery("a[rel^=\'prettyPhoto\']").prettyPhoto({
 changepicturecallback: function(){
 jQuery(".pp_social").append("");
 $getit= settings.image_markup.replace(/{path}/g,pp_images[set_position]);
 jQuery(".pp_pic_holder").find(\'.pp_details .pp_download_place\').html(\'Download\');
 }
 });
});
';
}

 

You can download the above code also from gist:

https://gist.github.com/lenasterg/3f46bf31a04321588d2bc2a01bb4b9be