wordpress 编辑器增加中文字体

  核心提示:博客自带的TinyMCE编辑器编辑的字体选项中没有中文字体!让我很苦恼!大家的方法是修改wordpress系统文件!这样有个不好的就是影响系统稳定性以及升级失效的难题!经过我的艰苦寻找,终于找到了新的方法!下面,我就将它分享给大家!希望大家喜欢!   首先我们,打开主题的functions.php文…

博客自带的TinyMCE编辑器编辑的字体选项中没有中文字体!让我很苦恼!大家的方法是修改wordpress系统文件!这样有个不好的就是影响系统稳定性以及升级失效的难题!经过我的艰苦寻找,终于找到了新的方法!下面,我就将它分享给大家!希望大家喜欢!   首先我们,打开主题的functions.php文件,在php代码结尾前加入以下代码!

 

 

代码如下:
01//编辑器字体02function conference_change_mce_options($initArray) {03$initArray['theme_advanced_blockformats'] = 'p,address,pre,code,h3,h4,h5,h6';04$initArray['theme_advanced_disable'] = 'forecolor';05if ( isset($initArray['theme_advanced_fonts'])){06    $initArray['theme_advanced_fonts'] = '微软雅黑=微软雅黑;宋体=宋体;黑体=黑体;仿宋=仿宋;楷体=楷体;隶书=隶书;幼圆=幼圆;'.$initArray['theme_advanced_fonts'];07}else {08    $initArray['theme_advanced_fonts'] = '微软雅黑=微软雅黑;宋体=宋体;黑体=黑体;仿宋=仿宋;楷体=楷体;隶书=隶书;幼圆=幼圆;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';09}10   return $initArray;11}12add_filter('tiny_mce_before_init', 'conference_change_mce_options',999); 然后上传覆盖!就大功告成了!试试吧!当然了我列举的那些字体大家还可以另外删减,并不仅限于中文字体!

未经允许不得转载:445IT之家 » wordpress 编辑器增加中文字体

赞 (0) 打赏

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏