方法一:开启全部隐藏功能

WordPress默认不支持TinyMCE的全部功能,但它支持的功能也没有全部开启,将下面的代码放到主题的functions.php中,就可以开启全部隐藏功能了。

function add_mce_buttons_1($buttons) {
$buttons = array('newdocument','undo','redo','|','bold','italic','underline','strikethrough','|','justifyleft','justifycenter','justifyright','justifyfull','|','styleselect','formatselect','fontselect','fontsizeselect','wp_more','wp_adv');
return $buttons;
}

function add_mce_buttons_2($buttons) {
$buttons = array('cut','copy','paste','pastetext','pasteword','|','search','replace','|','bullist','numlist','|','outdent','indent','blockquote','|','|','link','unlink','anchor','image','cleanup','code','|','forecolor','backcolor','hr','removeformat','visualaid','|','sub','sup','|','spellchecker','charmap','fullscreen','wp_help');
return $buttons;
}

add_filter("mce_buttons", "add_mce_buttons_1");
add_filter("mce_buttons_2", "add_mce_buttons_2");

方法二找到你正在使用的那个主题的模版函数文件(也就是functions.php这个文件),在其中加入下面这段代码:

//增强编辑器开始

function add_editor_buttons($buttons) {

$buttons[] = 'fontselect';

$buttons[] = 'fontsizeselect';

$buttons[] = 'cleanup';

$buttons[] = 'styleselect';

$buttons[] = 'hr';

$buttons[] = 'del';

$buttons[] = 'sub';

$buttons[] = 'sup';

$buttons[] = 'copy';

$buttons[] = 'paste';

$buttons[] = 'cut';

$buttons[] = 'undo';

$buttons[] = 'image';

$buttons[] = 'anchor';

$buttons[] = 'backcolor';

$buttons[] = 'wp_page';

$buttons[] = 'charmap';

return $buttons;

}

add_filter("mce_buttons_3", "add_editor_buttons");

//增强编辑器结束

附上搜集的按钮调用的Key,添加更多功能的时候只要把代码中 “$buttons[] =” 后面单引号内的单词换成下面括号里列出的那些Key就可以

wordpress编辑器按钮调用的Key:

1.剪切(cut)复制(copy)粘贴(paste)撤销(undo)重做(redo)居中(justifycenter)

2.加粗(bold)斜体(italic)左对齐(justifyleft)右对齐(justfyright)

3.两端对齐(justfyfull)插入超链接(link)取消超链接(unlink)插入图片(image)

4.清除格式(removeformat)下划线(underline)删除线(strikethrough)

5.锚文本(anchor)新建文本(newdocument)

6.字体颜色(forecolor)字体背景色(backcolor)

7.格式选择(formmatselect)字体选择(fontselect)字号选择(fontsizeselect)

8.样式选择(styleselect)无序列表(bullist)编号列表(numlist)

9.减少缩进(outdent)缩进(indent)帮助(wp_help)

10打开HTML代码编辑器(code)水平线(hr)清除冗余代码(cleanup)

11.上标(sub)下标(sup)特殊符号(charmap)插入more标签(wp_more)

12.插入分页标签(wp_page)

13.隐藏按钮显示开关(wp_adv)

14.隐藏按钮区起始部分(wp_adv_start)

15.隐藏按钮区结束部分(wp_adv_end)

16.拼写检查(spellchecker)

 

 

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注