我正在使用这段代码在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);
}怎么可能在同一个插件管理页面中将另一个文本区id=mytextarea2改成一个小的mce编辑器?
发布于 2011-08-16 19:46:32
我找到了一个合适的解决方案:将第二个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);
}发布于 2011-08-05 22:38:20
尝试使用the_editor($content, $id);,其中$content是您的HTML,$id是您的表单名称和id属性。如果编辑页面上有或没有其他实例(如默认内容编辑器),您可能必须在此之后调用wp_tiny_mce()。
-为清晰起见编辑...
the_editor()输出整个TinyMCE/HTML选项卡式编辑器部分。您可以根据需要多次调用此函数。
wp_tiny_mce()输出TinyMCE初始化脚本标记,因此每页只能调用一次。
发布于 2011-11-22 04:07:45
https://stackoverflow.com/questions/6957674
复制相似问题