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 in the process of trying to build a improved media library for our contributors. I have set up a custom taxonomy category for media, and set up a tab in the Add Media popup box for browsing through the various media categories.

I'm stumbling on the final piece of the jigsaw to insert the HTML code for the image using a button (in the same way the default media library does).

Below is a screenshot to give you a clearer idea of what I've built this far. I had found what I thought was a solution using tinyMCE.activeEditor.setContent as an onclick function, but it didn't do anything.

snapshot

share|improve this question
add comment

1 Answer

Got this working using window.parent.send_to_editor

function wcmediaInsert()
{
window.parent.send_to_editor('<?php echo wp_get_attachment_image($attachment->ID, 'large', false, $attr); ?>');
window.parent.tb_remove();
}

share|improve this answer
1  
It is better if you provide a little bit of commentary on the code, instead of just posting the code. –  s_ha_dum Jan 25 '13 at 14:56
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.