Question

I'm using a very lightweight plugin called WPAlchemy that lets me rapidly create meta-boxes for posts and pages. I've ben able to convert <textarea>'s into rich, TinyMCE's editors just fine. The problem is, I'd like to include the Media Upload buttons for those metaboxes / editors.

I've been able to add the buttons above each TinyMCE editor but when I click "Insert into Post" it isn't (has no idea) which <textarea> to insert the requested picture/media. For reference, I'm adding the following line above my <textarea>:

<div id="media-buttons" class="hide-if-no-js"><?php do_action( 'media_buttons' ); ?></div>

I'm aware this isn't valid since I'm using the same id, (#media-buttons) as what the default content editor uses at the top.

Someone suggested the following JS code to kinda hook and grab the src but I can't get this working for my scenario. (Suggestions came from here http:(slash)(slash)farinspace.com/multiple-wordpress-wysiwyg-visual-editors/comment-page-1/#comment-3552)

Finally, I'm attaching an image of what it currently looks like, but it just doesn't link the "Insert Into Post" button with the currently focused metabox. Image: http:(slash)(slash)cl.ly/4BMf

Any help, please?

Was it helpful?

Solution

Here is a complete tutorial with source files that do exactly what you want,
You can upload multi images by cloning the input field and also you can preview, delete images with ajax, add multi metaboxes to multiple/different post types and more.

http://www.deluxeblogtips.com/2010/05/howto-meta-box-wordpress.html

And here you can find some good information on how you call the attached images,
http://digwp.com/2009/08/awesome-image-attachment-recipes-for-wordpress/

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top