在wordpress的插件页面中添加多个微型mce编辑器

在wordpress的插件页面中添加多个微型mce编辑器,wordpress,plugins,tinymce,Wordpress,Plugins,Tinymce,我正在使用这段代码在wordpress 3.2.1的插件页面中添加微型mce // attach the tiny mce editor to this textarea if (function_exists('wp_tiny_mce')) { add_filter('teeny_mce_before_init', create_function('$a', ' $a["theme"] = "advanced"; $a["skin"] = "wp_theme";

我正在使用这段代码在wordpress 3.2.1的插件页面中添加微型mce

// attach the tiny mce editor to this textarea
if (function_exists('wp_tiny_mce')) {

  add_filter('teeny_mce_before_init', create_function('$a', '
    $a["theme"] = "advanced";
    $a["skin"] = "wp_theme";
    $a["height"] = "200";
    $a["width"] = "800";
    $a["onpageload"] = "";
    $a["mode"] = "exact";
    $a["elements"] = "mytextarea";
    $a["editor_selector"] = "mceEditor";
    $a["plugins"] = "safari,inlinepopups,spellchecker";

    $a["forced_root_block"] = false;
    $a["force_br_newlines"] = true;
    $a["force_p_newlines"] = false;
    $a["convert_newlines_to_brs"] = true;

    return $a;'));

 wp_tiny_mce(true);
}
如何在同一插件管理页面中将另一个textarea id=mytextarea2更改为一个微型mce编辑器?

尝试
编辑器($content,$id)其中,$content是HTML,$id是表单名和id属性。如果编辑页面上没有或没有其他实例(如默认内容编辑器),则在此之后可能必须调用
wp\u tiny\u mce()

---为清晰起见编辑

编辑器()
输出整个TinyMCE/HTML选项卡编辑器部分。您可以根据需要多次拨打此电话

wp\u tiny\u mce()
输出TinyMCE初始化脚本标记,因此每页只能调用一次。

尝试
编辑器($content,$id)其中,$content是HTML,$id是表单名和id属性。如果编辑页面上没有或没有其他实例(如默认内容编辑器),则在此之后可能必须调用
wp\u tiny\u mce()

---为清晰起见编辑

编辑器()
输出整个TinyMCE/HTML选项卡编辑器部分。您可以根据需要多次拨打此电话


wp\u tiny\u mce()
输出TinyMCE初始化脚本标记,因此每页只能调用一次。

我找到了一个合适的解决方案:将第二个id添加到元素参数:

// attach the tiny mce editor to this textarea
if (function_exists('wp_tiny_mce')) {

  add_filter('teeny_mce_before_init', create_function('$a', '
    $a["theme"] = "advanced";
    $a["skin"] = "wp_theme";
    $a["height"] = "200";
    $a["width"] = "800";
    $a["onpageload"] = "";
    $a["mode"] = "exact";
    $a["elements"] = "mytextarea,mytextarea2";
    $a["editor_selector"] = "mceEditor";
    $a["plugins"] = "safari,inlinepopups,spellchecker";

    $a["forced_root_block"] = false;
    $a["force_br_newlines"] = true;
    $a["force_p_newlines"] = false;
    $a["convert_newlines_to_brs"] = true;

    return $a;'));

 wp_tiny_mce(true);
}

我找到了一个合适的解决方案:将第二个id添加到elements参数:

// attach the tiny mce editor to this textarea
if (function_exists('wp_tiny_mce')) {

  add_filter('teeny_mce_before_init', create_function('$a', '
    $a["theme"] = "advanced";
    $a["skin"] = "wp_theme";
    $a["height"] = "200";
    $a["width"] = "800";
    $a["onpageload"] = "";
    $a["mode"] = "exact";
    $a["elements"] = "mytextarea,mytextarea2";
    $a["editor_selector"] = "mceEditor";
    $a["plugins"] = "safari,inlinepopups,spellchecker";

    $a["forced_root_block"] = false;
    $a["force_br_newlines"] = true;
    $a["force_p_newlines"] = false;
    $a["convert_newlines_to_brs"] = true;

    return $a;'));

 wp_tiny_mce(true);
}

“编辑器选择器”基于class属性

因此,只需对所有要使用TinyMCE的文本区域使用相同的类。

From

“编辑器选择器”基于class属性

因此,只需对所有要使用TinyMCE的TextArea使用相同的类