問題描述
我有一個很好的小功能從 WordPress 中的 tinyMCE 編輯器中刪除按鈕,到目前為止,我已經能夠刪除我需要的大部分。
function custom_disable_mce_buttons( $opt ) {
$opt['theme_advanced_disable'] = 'justifyfull,forecolor,removeformat,justifycenter,justifyright,justifyleft,charmap,indent,outdent,undo, redo';
return $opt;
}
add_filter('tiny_mce_before_init', 'custom_disable_mce_buttons');
按鈕控件列表可以在這裏找到:http://www.tinymce.com/wiki.php/TinyMCE3x:Buttons/controls
問題是,還有一些我想要刪除的東西,如拼寫檢查器和 「插入更多的標籤」,但是我找不到這些按鈕的代碼/名稱的任何文件來刪除它們。
有什麼信息嗎?
最佳解決方案
wp_more – 插入更多按鈕,
spellchecker – 拼寫檢查按鈕
我已經嘗試了你的代碼在 WP 3.5.1,它工作正常為我。
次佳解決方案
您可以嘗試刪除拼寫檢查器和插入更多標籤按鈕,方法是添加:
spellchecker, wp_more
到您的 $opt['theme_advanced_disable'] comma-seperated 字符串。
在我的安裝我有這些選項:
[theme_advanced_buttons1] => bold,italic,strikethrough,bullist,numlist,blockquote,justifyleft,justifycenter,justifyright,link,unlink,wp_more,spellchecker,wp_fullscreen,wp_adv,separator
[theme_advanced_buttons2] => formatselect,underline,justifyfull,forecolor,pastetext,pasteword,removeformat,charmap,outdent,indent,undo,redo,wp_help
這是列表:
bold,
italic,
strikethrough,
bullist,
numlist,
blockquote,
justifyleft,
justifycenter,
justifyright,
link,
unlink,
wp_more,
spellchecker,
wp_fullscreen,
wp_adv,
separator,
和
formatselect,
underline,
justifyfull,
forecolor,
pastetext,
pasteword,
removeformat,
charmap,
outdent,
indent,
undo,
redo,
wp_help
第三種解決方案
add_filter("mce_buttons", "tinymce_editor_buttons", 99); //targets the first line
add_filter("mce_buttons_2", "tinymce_editor_buttons_second_row", 99); //targets the second line
function tinymce_editor_buttons($buttons) {
return array(
"undo",
"redo",
"separator",
"bold",
"italic",
"underline",
"strikethrough",
//"separator",
//"bullist",
//"separator",
//add more here...
);
}
function tinymce_editor_buttons_second_row($buttons) {
//return an empty array to remove this line
return array();
}
結果:
參考文獻
注:本文內容整合自 Google/Baidu/Bing 輔助翻譯的英文資料結果。如果您對結果不滿意,可以加入我們改善翻譯效果:薇曉朵技術論壇。
