How to add wysiwyg editor in Wordpress meta box

2019-01-17 21:35发布

I'm creating a meta box for my custom post type. There are multiple fields where I would like to use wysiwyg editor rather than <textarea>. Is is possible to add multiple editors to a meta box?

I would really appreciate your help!

Many thanks. Dasha

8条回答
冷血范
2楼-- · 2019-01-17 21:55

This did the trick for me:

http://www.farinspace.com/multiple-wordpress-wysiwyg-visual-editors/

It's basically creating your textarea with an id, then calling from js:

tinyMCE.execCommand('mceAddControl', false, 'your_textarea_id');

Hope it helps!

查看更多
虎瘦雄心在
3楼-- · 2019-01-17 21:56

But you need to replace presentation with nl2br() function as textarea in custom templates have the toogle JS issue, that removes all your <P> and <br/> tags and therefore all line breaks.

查看更多
登录 后发表回答