SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function($){
  2.     $(document).ready(function(){
  3.         $('button#custom_img').live("click",function(event){
  4.             event.preventDefault();
  5.             var imageUploader = wp.media({
  6.                 'title' : 'Upload Image',
  7.                 'button' : {
  8.                     'text' : 'Set image'
  9.                 }
  10.             });
  11.             imageUploader.open();
  12.  
  13.             imageUploader.on("select", function(){
  14.                 var image = imageUploader.state().get("selection").first().toJSON();
  15.                 var link = image.url;
  16.                 $("input.imglink").val( link );
  17.                 $(".image_show img").attr('src', link );
  18.             });
  19.         });
  20.     });
  21. }(jQuery))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top