如何在 WordPress 中使用新的 add_editor_style() 函数? [英] How do I use new add_editor_style() function in wordPress?
问题描述
我找到了这篇文章:
http://www.deluxeblogtips.com/2010/05/editor-style-wordpress-30.html
我使用Twentyten 主题作为父主题创建了一个子主题.我正在尝试让 WYSIWYG 编辑器使用自定义样式表.
I created a child theme using the Twentyten theme as a parent. I am trying to have the WYSIWYG editor use a custom stylesheet.
我将此添加到我的functions.php文件中:
I added this to my functions.php file:
add_editor_style();
然后我在我的子主题文件夹中创建了一个 editor-style.css 文件并添加了这个:
Then I created an editor-style.css file in my child theme's folder and added this:
html .mceContentBody {
max-width:591px;
}
当我转到 WYSIWYG 编辑器并使用 firebug 检查影响 .mceContentBody 元素的 css 时,我可以看到它正在使用我的样式表,但它被默认编辑器覆盖来自二十个主题的 -style.css 表.
When I go to the WYSIWYG editor and use firebug to check the css that is affecting the .mceContentBody element, I can see that is using my stylesheet, but it is being overrriden by the default editor-style.css sheet from the twentyten theme.
如何强制它使用我的 editor-style.css 文件而不是默认文件?
How can I force it to use my editor-style.css file and not the default one?
推荐答案
add_theme_support('editor_style');
add_theme_support('editor_style');
之前
add_editor_style('tinymce-styles.css');
假设您的自定义 css 位于模板的根文件夹中.
assuming that your custom css is in your template's root folder.
这篇关于如何在 WordPress 中使用新的 add_editor_style() 函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!