Guest User

Calling Wordpress Build In Media Manager / Uploaded on button click

a guest
Aug 28th, 2010
297
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. jQuery.noConflict();
  2. jQuery(document).ready(function($) {
  3.  
  4. var ww = $('input[name=post_ID]').val();
  5. var which_button;
  6.  
  7. $('.meta_upload_button').each(function() {
  8.  
  9.     var button = $(this);
  10.  
  11.     $(this).click(function() {
  12.         which_button = button;
  13.         window.send_to_editor=window.send_to_editor_clone;
  14.         tb_show('', 'media-upload.php?post_id=' + ww + '&type=image&TB_iframe=true');
  15.         return false;
  16.     });
  17.  
  18.  
  19.     window.send_to_editor_clone = function(html){
  20.         imgurl = $('img',html).attr('src');
  21.         forminput = which_button.prev('input');
  22.         forminput.val(imgurl);
  23.        
  24.         tb_remove();
  25.     }
  26.  
  27. }); //end each
  28.  
  29.  
  30. }); //end document ready
RAW Paste Data