2013-08-05 32 views
0

我在WordPress中使用TinyMCE,当你输入编辑器时,文本的颜色是#333333或rgb(51,51,51)。奇怪的是,“选择文本颜色”按钮中的默认颜色是#eeeeee,但是当您在页面加载时键入时,它仍然是#333333。我使用的functions.php这个函数来设置颜色:在WordPress中指定TinyMCE编辑器的字体颜色?

function change_mce_options($init) { 
    $init['theme_advanced_default_foreground_color'] = '#eeeeee'; 
    $init['theme_advanced_text_colors'] = 'eeeeee,ff4343,8383cc'; 
return $init; } 
add_filter('tiny_mce_before_init', 'change_mce_options'); 

如何更改默认字体颜色和文字的字体家族都进入了编辑器?

+0

您可以尝试使用高级的Tinymce插件,不需要代码来执行 –

+0

我更愿意使用几行代码将新插件添加到组合中。 – eclipsis

回答

1

创建你的主题根文件夹my-editor-style.css样式表,并把你的风格有:

body#tinymce.wp-editor { 
    font-family: Arial, Helvetica, sans-serif; 
} 

body#tinymce.wp-editor a { 
    color: #4CA6CF; 
} 

最后加入以下钩到您functions.php文件加载该文件:

add_action('init', 'wpse8170_add_editor_styles'); 
function wpse8170_add_editor_styles() { 
    add_editor_style('my-editor-style.css'); 
} 

了解更多关于editor styles在codex中。

+0

很好的答案,谢谢尤金。 – eclipsis

相关问题