admin管理员组文章数量:1125626
I have added some text on tinymce editor on load.
(Every time you click on Add new the tinymce editor load with this text.)
but problem is how to enable css class which are using in default text.
Thanks
I have added some text on tinymce editor on load.
(Every time you click on Add new the tinymce editor load with this text.)
but problem is how to enable css class which are using in default text.
Thanks
Share Improve this question edited Jan 20, 2013 at 6:43 shea 5,6324 gold badges38 silver badges62 bronze badges asked Apr 11, 2012 at 9:06 Wordpress DWordpress D 831 gold badge1 silver badge4 bronze badges3 Answers
Reset to default 12Use add_editor_style
e.g.: functions.php
add_editor_style('custom-editor-style.css');
http://codex.wordpress.org/Function_Reference/add_editor_style
add_editor_style
is recommended for theme.
You can mce_css
filter in plugin. The following sample code is from here
function plugin_mce_css( $mce_css ) {
if ( !empty( $mce_css ) )
$mce_css .= ',';
$mce_css .= plugins_url( 'editor.css', __FILE__ );
return $mce_css;
}
add_filter( 'mce_css', 'plugin_mce_css' );
Nothing I found worked. Took me half a day on Google, but finally stumbled upon this script that works:
function kwh_add_editor_style( $mceInit ) {
$custom_css = get_theme_mod( 'custom_css' );
$styles = '.mce-content-body { EDIT YOUR CUSTOM CSS HERE ' . $custom_css . '; }';
if ( !isset( $mceInit['content_style'] ) ) {
$mceInit['content_style'] = $styles . ' ';
} else {
$mceInit['content_style'] .= ' ' . $styles . ' ';
}
return $mceInit;
}
add_filter( 'tiny_mce_before_init', 'kwh_add_editor_style' );
Source of snippet.
本文标签: customizationHow to include own css on wordpress tinymce editor
版权声明:本文标题:customization - How to include own css on wordpress tinymce editor? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736667554a1946745.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论