如何为 Wordpress 更改 TinyMCE 的默认字体 [英] How to change the default font of TinyMCE for Wordpress
问题描述
我在 SO 上看到这个问题,但所有答案都没有具体说明如何改变它.
I see this question on SO but all answers fail to be specific on how to change that.
我的意思是:答案说添加这个",但他们没有说明在哪里,我的意思是,哪个文件和一个必须是火箭科学家才能弄清楚.
What I mean is this: the answers say "add this" but they fail to tell where, I mean, which file and one has to be a rocket scientist to figure that out.
有人可以解释一下就像我五岁一样,好吧,把它变成 3...我必须做的所有步骤来摆脱臭名昭著的 Libre Franklin 字体并将 Helvetica 作为 TinyMCE 编辑器的默认设置为 wordpress?
Can someone explain like I am five, ok, make it 3... all steps I have to do to get rid of the infamous Libre Franklin font and put Helvetica as the default on TinyMCE editor for wordpress?
谢谢
推荐答案
这个 post 给出了非常明确的说明.
This post gives pretty clear instructions.
1) 添加一个新的 css 文件,随意命名,例如 tinymce_custom_editor.css
,例如,将其上传到主题中的css"文件夹 -> wp-content/themes/YOUR-THEME/css/
1) Add a new css file, called it whatever you want, like tinymce_custom_editor.css
for example, upload it to the folder "css" in your theme -> wp-content/themes/YOUR-THEME/css/
2) 在您的主题 function.php
文件中添加一个新函数:
2) Add a new function in your theme function.php
file:
用下面的代码↓制作一个文件tinymce_custom_editor.css
,然后把它添加到文件夹wp-content/themes/grandblog/css
Make a file tinymce_custom_editor.css
with following code ↓, then add it to folder wp-content/themes/grandblog/css
body#tinymce.wp-editor {
font-family: Arial, Helvetica, sans-serif !important;
}
功能
在wp-content/themes/YOUR-THEME/functions.php
↓
function my_theme_add_editor_styles() {
add_editor_style( 'css/tinymce_custom_editor.css' );
}
add_action( 'after_setup_theme', 'my_theme_add_editor_styles' );
这篇关于如何为 Wordpress 更改 TinyMCE 的默认字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!