【插件】如何让WordPress使用中文字体

Linda 2020年1月9日10:52:25
评论
2,986

现在市场上的网站有30%的是使用wordprdess程序搭建,其中有不少人拿来搭中文站。而wordpress偏向于英文编辑者的使用习惯,在字体上也有局限,在默认的情况下直接使用中文字会比较不美观,这篇文章将会改善字体问题,先看下使用前和使用后的效果图

使用前,无法选择字体

【插件】如何让WordPress使用中文字体

使用后,可以选择中文字体

【插件】如何让WordPress使用中文字体

现在来说说是怎么实现的效果

首先,安装并激活插件TinyMCE Advanced

【插件】如何让WordPress使用中文字体

第二,插入代码至Appearance – Edit – Functions.php

function custum_fontfamily($initArray){
$initArray[‘font_formats’] = “微软雅黑=’微软雅黑’;宋体=’宋体’;黑体=’黑体’;仿宋=’仿宋’;楷体=’楷体’;隶书=’隶书’;幼圆=’幼圆’;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=v erdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats”;
return $initArray;
}
add_filter(‘tiny_mce_before_init’, ‘custum_fontfamily’);

记得别忘记update!!!

Linda
  • 本文由 发表于 2020年1月9日10:52:25
  • 转载请务必保留本文链接:https://beydian.com/how-to-use-chinese-font-on-wordpress/

发表评论