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 recently started using this nifty meta box framework: http://www.deluxeblogtips.com/meta-box-script-for-wordpress/

I really like the plupload meta box, however, I need to be able to add the uploaded image into the editor rather than just attaching it to the post.

Any idea how I can create a button that inserts the correct attachment into the editor like it works with the regular "insert into post" button when uploading using the regular uploader?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You can add content to the editor via javascript:

tinyMCE.activeEditor.selection.setContent('<img src="hello.jpg">');
share|improve this answer
    
Thanks for your reply. I googled around, all I could find is how to incorporate that code into a button in TinyMCE. How can I make a link within my metabox that sends images to the editor? –  INT Jun 25 '12 at 9:49
    
attach that javascript to the link in your metabox with an onclick or jQuery's click handler and pass whatever content you want inserted. –  Milo Jun 25 '12 at 13:10
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.