WordPress切换到经典编辑器果然好用多了,但没有字体、字号选择,不便于中文的撰写。
通过在单签主题functions.php 模板文件末尾增加以下代码可以完美解决。
function MBT_add_editor_buttons($buttons) {
$buttons[] = ‘fontselect’;
$buttons[] = ‘fontsizeselect’;
$buttons[] = ‘cleanup’;
$buttons[] = ‘styleselect’;
$buttons[] = ‘del’;
$buttons[] = ‘sub’;
$buttons[] = ‘sup’;
$buttons[] = ‘copy’;
$buttons[] = ‘paste’;
$buttons[] = ‘cut’;
$buttons[] = ‘image’;
$buttons[] = ‘anchor’;
$buttons[] = ‘backcolor’;
$buttons[] = ‘wp_page’;
$buttons[] = ‘charmap’;
return $buttons;
}
add_filter(“mce_buttons_3”, “MBT_add_editor_buttons”);
function add_fontfamily($initArray){
$initArray[‘font_formats’] = “微软雅黑=’微软雅黑’;宋体=’宋体’;黑体=’黑体’;仿宋=’仿宋’;楷体=’楷体’;隶书=’隶书’;幼圆=’幼圆’;Arial=’Arial’;”;
return $initArray;
}
add_filter(‘tiny_mce_before_init’, ‘add_fontfamily’);