How do I use new add_editor_style() function in wordPress?

我怕爱的太早我们不能终老 提交于 2019-12-25 00:37:40

问题


I found this article:

http://www.deluxeblogtips.com/2010/05/editor-style-wordpress-30.html

I created a child theme using the Twentyten theme as a parent. I am trying to have the WYSIWYG editor use a custom stylesheet.

I added this to my functions.php file:

add_editor_style();

Then I created an editor-style.css file in my child theme's folder and added this:

html .mceContentBody {
    max-width:591px;
}

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.

How can I force it to use my editor-style.css file and not the default one?


回答1:


add_theme_support('editor_style');

before

add_editor_style('tinymce-styles.css');

assuming that your custom css is in your template's root folder.




回答2:


Try redeclaring twentyten_setup in your theme's functions.php file. Just copy and paste the whole function from twentyten to your theme.




回答3:


Check your CSS for errors. I spent hours pulling my hair out wondering why wordpress wasn't using my stylesheet. It wasn't even getting included. Turns out i had an extra { in my css.



来源:https://stackoverflow.com/questions/3490774/how-do-i-use-new-add-editor-style-function-in-wordpress

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!