WordPress插件Advanced Editor Tools,TinyMCE编辑器添加中文字体

打开当前主题的functions.php文件,加入下方代码

// 为 TinyMCE 编辑器增加中文字体
function custom_fontfamily($initArray) {
    $initArray['font_formats'] = "微软雅黑='Microsoft YaHei';宋体='SimSun';黑体='SimHei';仿宋='FangSong';楷体='KaiTi';隶书='LiSu';幼圆='YouYuan';Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats";
    return $initArray;
}
add_filter('tiny_mce_before_init', 'custom_fontfamily');

 

THE END