0

So I have made some custom textareas on my frontpage template. This works fine and I can safe content and so on... But I am experiencing some issues.

When I click "Upload/Insert" I can work with the dialogue - but when I type insert the dialogue closes but no image is inserted into the textarea...

The other issue is with the to tabs "visuel" and "HTML". I cant click on the "HTML" tab... nothing happens... I get the following javascript error:

vta is null
anonymous()
anonymous()
onclick()
event = click clientX=1523, clientY=145
qtrans_save(vta.value);

I call the wp_editor with:

wp_editor( $meta, $field['id']);

The field ID's are unique and currently using _ like 'custom_frontpage_textarea3'. I have tried without the _ but that had no effect.

Any ideas?

1 Answer 1

1

Not saying it's not possible, but wp_editor is not designed to be used in a meta box (when tinyMCE, which is on by default, is activated). Here's the trac ticket where some of the issues are discussed.

You can however, use the actions edit_page_form or edit_form_advanced to add your editor with tinyMCE, as suggested by azzoz, or, use the HTML only editor, as suggested by nacin.

Edit: Here's an example of adding the editor with tinyMCE disabled:

wp_editor( $meta, $field['id'], array ( 'tinymce' => false ) );

I tested it by adding 2 editors and was able to insert media into each editor using the insert into post button. If you can do without tinyMCE, then this is probably the way to go. Otherwise, you'll need to add your editors using the hooks mentioned above.

5
  • So there is no way to have several text boxes pr. page? I need to control a lot of html that the editor is not allowed to change... and there are several boxes that they can and they need an editor like wp_editor :S Commented Jul 13, 2012 at 20:57
  • Hrmm, no I didn't say that! :) -- It's just that there are problems with using wp_editor inside a meta box when the parameter tinymce is set to true (which is the case by default). I updated my answer with with an example. Commented Jul 13, 2012 at 21:28
  • Ye but then the issue is that the editor still cant use image uploade etc. :( I tried your solutions - yes - it removes tinymce but the problem is still the same Commented Jul 13, 2012 at 21:36
  • It worked for me. The media buttons are present above each instance and I was able to upload and insert into individual editors. Please post your whole code, and maybe we can be of more help. Commented Jul 13, 2012 at 21:45
  • Hey goto10. I have decided (for now) to not allow the user to change the content that much. I am restricting the user to only use text and have changed the meta box to a simple textarea. Thanks for your help. I might though in the future be forced to try and tackle this issue again :) Commented Jul 19, 2012 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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