The7加入微软雅黑和宋体——或其他需要的中文字体

技术流23,4622阅读模式

The7主题默认加入了谷歌字体。但是谷歌字体在中国境内使用会有各种各样的问题。文章源自原紫番博客-https://www.yuanzifan.com/53949.html

如果你需要用个黑体、雅黑、华文行楷。会发现居然没法操作。文章源自原紫番博客-https://www.yuanzifan.com/53949.html

研究了好久,终于找到了办法。文章源自原紫番博客-https://www.yuanzifan.com/53949.html

其实他的谷歌字体,是在谷歌的服务器完全导入列表。然后在通过字体代码,直接调取字体服务器的内容。文章源自原紫番博客-https://www.yuanzifan.com/53949.html

只需要找到正确的字体代码,就可以加入新的字体。文章源自原紫番博客-https://www.yuanzifan.com/53949.html

首先,打开根目录。(本教程适用于The7. 7.6版本,再之前的版本是另外的方法)。文章源自原紫番博客-https://www.yuanzifan.com/53949.html

打开:/wp-content/themes/dt-the7/inc/extensions文件夹。找到web-fonts.php文件。文章源自原紫番博客-https://www.yuanzifan.com/53949.html

你会发现这个文件下面其实列举了N多字体。文章源自原紫番博客-https://www.yuanzifan.com/53949.html

我这里需要加入微软雅黑和楷体。因此在代码里加入两行(下面黄色部分)文章源自原紫番博客-https://www.yuanzifan.com/53949.html

保存刷新下,即可在The7后台找到对应的楷体。文章源自原紫番博客-https://www.yuanzifan.com/53949.html

  'Microsoft YaHei' => 'Microsoft YaHei', 
  'STKaiti' => 'STKaiti',
  'ABeeZee' => 'ABeeZee',
  'ABeeZee:400italic' => 'ABeeZee  italic',
  'Abel' => 'Abel',
  'Abhaya Libre' => 'Abhaya Libre',
  'Abhaya Libre:500' => 'Abhaya Libre (500) ',
  'Abhaya Libre:600' => 'Abhaya Libre (600) ',
  'Abhaya Libre:700' => 'Abhaya Libre (700) ',
  'Abhaya Libre:800' => 'Abhaya Libre (800) ',
  'Abhaya Libre&subset=latin-ext' => 'Abhaya Libre latin-ext',
  'Abhaya Libre&subset=sinhala' => 'Abhaya Libre sinhala',
  'Abhaya Libre:500&subset=latin-ext' => 'Abhaya Libre (500)  latin-ext',
  'Abhaya Libre:500&subset=sinhala' => 'Abhaya Libre (500)  sinhala',
 最后更新:2019-7-27
评论  2  访客  1  作者  1
    • G.Robber 0

      请问加入微软雅黑粗体怎么加呢, 我这么写’Microsoft YaHei Bold’ => ‘Microsoft YaHei Bold’ 并不起作用

    发表评论

    匿名网友
    :?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
    确定

    取消

    拖动滑块以完成验证