Is there way to have multiple WYSIWYG editors for a custom post type? For example, if I had a 2 column layout I wanted to have one editor for one column and another editor for the other.
|
|
Say your custom post type was called
Then, taking this as the most basic example, you must attach the tinyMCE editor to a textarea. We still have to define our
There are a couple of issues which I'm not sure of how to overcome. The tinyMCE editor will be nested inside of a metabox, which might not be ideal, and it will not feature the ability to switch between HTML and Visual editing modes, as well as the the media insertion commands which the normal post editor has. Switching the modes appears to be defined as a function who's first argument is the ID, but yet it also appears to coded into the wp-tinymce script. It is possible to use the built in tinyMCE functions to do so, but this changes the textarea between full tinyMCE and a basic textarea, without any of the WP HTML insertion buttons. |
|||||||||
|
|
The default editor, tinymce, is loaded by a function in wp-admin/includes/post.php called wp_tiny_mce(); Look in the source at line 1350. There is an array of settings at line 1478. One of the options apparently designates the textarea selector to apply the javascript editor to. I was reading this post by Keighl on his blog that pointed me toward it. Read the article, and maybe there's a way to call wp_tiny_mce() in an admin section plugin and apply it to a second text area you create. |
|||
|
|
|
Bueltge has a nice article that shows how that can be done: http://wpengineer.com/1991/example-how-to-add-meta-boxes-to-edit-area/ |
|||
|
|
|
First: Big Thanks to @Thomas McDonald for his answer; I needed to figure out exactly the same question that @Paul Sheldrake asked and Thomas' code got me started in the right direction. Unfortunately I then got stuck because I needed to change the layout from the default to a simpler and smaller layout since I needed to use the TinyMCE in a side metabox. I looked practically everywhere for a solution and especially on the MoxieCode TinyMCE Wiki and TinyMCE Tips & How To Forum and found nothing! 1 Everything I found explained how to set I was about stumped when I ran across the article multiple TinyMCE 3 instances on one page by Hamilton Chua, and he nailed it! His solution was to assign
The sad part is this was really not hard, but it wasn't documented anywhere else I could find. It's amazing to discover almost nobody else has experienced this issue. So anyway the above code generated the following second TinyMCE in exactly the format/layout that my client needed:
So if you are using @Thomas McDonald code above you find you have any need to modify the layout be sure to check out Hamilton Chua's awesome article (thanks Ham!): P.S. If you do something even slightly wrong the TinyMCE may just not show at all. For example in my case I use Footnote1: Very frustrating! After little more than a month with WordPress Answer I'm now expecting to find answers to all my questions as the same level of quality as here, and elsewhere I'm typically finding disappointment! |
|||||||||||
|
|
I got it just by adding “theEditor” as class attribute to a textarea:
|
|||
|
|
