Last active
June 15, 2017 09:52
-
-
Save lenasterg/3f46bf31a04321588d2bc2a01bb4b9be to your computer and use it in GitHub Desktop.
Adds download functionality to prettyPhoto WordPress plugin. Put the code into yours theme functions.php or the file into mu-plugins folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | |
<script> | |
jQuery(document).ready(function() { | |
jQuery("a[rel^=\'prettyPhoto\']").prettyPhoto({ | |
changepicturecallback: function(){ | |
jQuery(".pp_social").append("<span class=\'pp_download_place\'></span>"); | |
$getit= settings.image_markup.replace(/{path}/g,pp_images[set_position]); | |
jQuery(".pp_pic_holder").find(\'.pp_details .pp_download_place\').html(\'<a class="pp_download" href="\'+pp_images[set_position]+\'" download>Download</a>\'); | |
} | |
}); | |
}); | |
</script>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment