Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using the following code for upload in multiple mextaboxes in a post or page admin section. Works for metaboxes but breaks the TinyMCE insert image. I want to know please how I can achieve this without breaking the TinyMCE. Off course the issue comes when I overwrite the windows.send_to_editor function.

jQuery(document).ready(function() {
    jQuery('.st_upload_button').click(function() {
         targetfield = jQuery(this).prev('.upload-url');
         tb_show('', 'media-upload.php?type=image&TB_iframe=true');
         return false;
    });
    window.send_to_editor = function(html) {
        imgurl = jQuery('img',html).attr('src');
        jQuery(targetfield).val(imgurl);
        tb_remove();
   }
});

A possible solution would be hiding "Insert into post" button which by the way is not to semantic in the metaboxes and put a new button like "Select image" and writing a function with take the img o attach url a assign to the input. How can I do that o something else you recommend?

Thanks in advance.

share|improve this question
add comment

2 Answers

I was looking at this answer earlier. It shows you how to remove fields from the Media Uploader, so maybe it'll set you on the right lines for writing an additional function to incorporate into the Uploader?

share|improve this answer
    
Thanks dunc, this answer part of my question! I know how to remove elements from media uploaded now. Thanks :) –  Deryck Oñate Espinel Apr 1 '12 at 15:42
add comment

problem is you are overwriting send_to_editor() function. I have a similar question answered by bainternet. Never had time to test it out. Let me know if it works for you. How to handle multiple instance of "send_to_editor" js function

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.