关于php:Wp_editor生成的WYSIWYG编辑器已禁用

WYSIWYG editor generated by Wp_editor is disabled

初始问题:

我的客户想要为其wordpress网站使用自定义HTML渲染侧栏小部件。我创建了一个简单的控件,允许他们选择颜色(类切换),并给他们一个文本区域以将HTML放入其中。现在他们已经要求附加一个基本的所见即所得接口(CKEditor或TinyMCE),但是我不知道如何将其添加到小部件代码内的textarea中。有谁知道如何做,有一个例子或一个地方看它如何工作?谢谢!

编辑(使用wp_editor后):

所以我现在有了代码,但是编辑器被禁用并且无法使用。有什么想法吗?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<fieldset>
    <label>Enter your HTML</label>

    <?php
    $settings = array(
        'wpautop' => true,
        'media_buttons' => false,
        'tinymce' => array(
            'theme_advanced_buttons1' => ',bold,italic,underline,|,link,unlink',

        ),
        'quicktags' => false
    );
    $bodyID = $this->get_field_id('body');
    $content = '';
    wp_editor($content, $bodyID, $settings );
    ?>
    </fieldset>

使用wp_editor函数,您的代码将如下所示:
http://codex.wordpress.org/Function_Reference/wp_editor

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 <fieldset>

    <label> Your label for the text area </label>

    <?php
    $settings = array(
        'wpautop' => true,
        'media_buttons' => false,
        'tinymce' => array(
            'theme_advanced_buttons1' => 'formatselect,|,bold,italic,underline,|,' .
                'bullist,blockquote,|,justifyleft,justifycenter' .
                ',justifyright,justifyfull,|,link,unlink,|' .
                ',spellchecker,wp_fullscreen,wp_adv ',

        ),
        'quicktags' => false
    );
    wp_editor('initial content', 'id of textarea', $settings );
    ?>
    </fieldset>

请注意,如果要从前端将内容放入WP数据库,则应另外使用wp_insert_post函数和POST变量作为链接。