wordpress怎么设置中文字体

在wordpress中设置中文字体的方法如下:

将如下代码加到当前主题的 functions.php 模板文件中:

function custum_fontfamily($initArray){
   $initArray['font_formats'] = "微软雅黑='微软雅黑';宋体='宋体';黑体='黑体';仿宋='仿宋';楷体='楷体';隶书='隶书';幼圆='幼圆';";
   return $initArray;
}
add_filter('tiny_mce_before_init', 'custum_fontfamily');
登录后复制

WordPress默认TinyMCE编辑器并没有选择字体功能,所以还需要把下面代码也一同加到 functions.php 模板文件中:

function enable_more_buttons($buttons) {
$buttons[] = 'styleselect';
$buttons[] = 'fontselect';
return $buttons;
}
add_filter("mce_buttons", "enable_more_buttons");
登录后复制

更多wordpress相关技术文章,请访问wordpress教程栏目进行学习!

以上就是wordpress怎么设置中文字体的详细内容,更多请关注慧达AI工具网其它相关文章!

转载请说明出处 内容投诉内容投诉
慧达seo-站长工具-seo工具-采集-发布-AI文章生成发布工具 » wordpress怎么设置中文字体

慧达AI专注站群seo管理工具

查看演示 官网购买