The method to set Chinese fonts in WordPress is as follows:
Add the following code to the functions.php template file of the current theme:
function custum_fontfamily($initArray){ $initArray['font_formats'] = "微软雅黑='微软雅黑';宋体='宋体';黑体='黑体';仿宋='仿宋';楷体='楷体';隶书='隶书';幼圆='幼圆';"; return $initArray; } add_filter('tiny_mce_before_init', 'custum_fontfamily');
The default TinyMCE editor of WordPress does not have the font selection function, so you need to add the following code to the functions.php template file:
function enable_more_buttons($buttons) { $buttons[] = 'styleselect'; $buttons[] = 'fontselect'; return $buttons; } add_filter("mce_buttons", "enable_more_buttons");
For more WordPress related technical articles, please visit wordpress tutorial column for learning!
The above is the detailed content of How to set Chinese font in wordpress. For more information, please follow other related articles on the PHP Chinese website!