您可以通过wp\\u editor()函数上的数组设置参数;一棵枫树
$settings = array(
\'tinymce\' => array(
\'setup\' => \'function (ed) {
tinymce.documentBaseURL = "\' . get_admin_url() . \'";
}\',
),
\'quicktags\' => TRUE,
\'editor_class\' => \'frontend-article-editor\',
\'textarea_rows\' => 25,
\'media_buttons\' => TRUE,
);
wp_editor( $content, \'article_content\', $settings );
您可以通过参数“tinymce”中的数组设置值,“tinymce”=>true,//加载tinymce,可以使用数组()将设置直接传递给tinymce,也可以了解按钮的参数:
theme_advanced_buttons1
,
theme_advanced_buttons2
,
theme_advanced_buttons3
,
theme_advanced_buttons4
array( \'theme_advanced_buttons1\' => \'bold, italic, ul, pH, temp\' )
您还可以通过过滤器挂钩来创建自定义按钮,这也是一个示例
function fb_change_mce_options($initArray) {
// Comma separated string od extendes tags
// Command separated string of extended elements
$ext = \'pre[id|name|class|style],iframe[align|longdesc|name|width|height|frameborder|scrolling|marginheight|marginwidth|src]\';
if ( isset( $initArray[\'extended_valid_elements\'] ) ) {
$initArray[\'extended_valid_elements\'] .= \',\' . $ext;
} else {
$initArray[\'extended_valid_elements\'] = $ext;
}
// maybe; set tiny paramter verify_html
//$initArray[\'verify_html\'] = false;
return $initArray;
}
add_filter( \'tiny_mce_before_init\', \'fb_change_mce_options\' );
也可以直接过滤按钮;每一行都有一个each过滤器:
mce_buttons
,
mce_buttons_2
,
mce_buttons_3
,
mce_buttons_4
以下参数是挂钩示例的默认参数:tiny_mce_before_init
\'mode\' => \'specific_textareas\'
\'editor_selector\' => \'theEditor\'
\'width\' => \'100%\'
\'theme\' => \'advanced\'
\'skin\' => \'wp_theme\'
\'theme_advanced_buttons1\' => \'bold,italic,strikethrough,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,|,link,unlink,wp_more,|,spellchecker,fullscreen,wp_adv\'
\'theme_advanced_buttons2\' => \'formatselect,underline,justifyfull,forecolor,|,pastetext,pasteword,removeformat,|,media,charmap,|,outdent,indent,|,undo,redo,wp_help\'
\'theme_advanced_buttons3\' => \'\'
\'theme_advanced_buttons4\' => \'\'
\'language\' => \'de\'
\'spellchecker_languages\' => \'English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,+German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv\'
\'theme_advanced_toolbar_location\' => \'top\'
\'theme_advanced_toolbar_align\' => \'left\'
\'theme_advanced_statusbar_location\' => \'bottom\'
\'theme_advanced_resizing\' => true
\'theme_advanced_resize_horizontal\' => false
\'dialog_type\' => \'modal\'
\'relative_urls\' => false
\'remove_script_host\' => false
\'convert_urls\' => false
\'apply_source_formatting\' => false
\'remove_linebreaks\' => true
\'gecko_spellcheck\' => true
\'entities\' => \'38,amp,60,lt,62,gt\'
\'accessibility_focus\' => true
\'tabfocus_elements\' => \'major-publishing-actions\'
\'media_strict\' => false
\'paste_remove_styles\' => true
\'paste_remove_spans\' => true
\'paste_strip_class_attributes\' => \'all\'
\'wpeditimage_disable_captions\' => false
\'plugins\' => \'safari,inlinepopups,spellchecker,paste,wordpress,media,fullscreen,wpeditimage,wpgallery,tabfocus\'
请参见上的
this link 有关此筛选器的更多信息。