dsw8292301 2013-08-05 02:03
浏览 178
已采纳

在WordPress中指定TinyMCE编辑器字体颜色?

I'm using TinyMCE in WordPress, and when you type in the editor, the color of the text is #333333 or rgb(51, 51, 51). What's odd is that the default color in the "Select text color" button is #eeeeee, yet when you type on page load, it's still #333333. I'm using this function in functions.php to set the colors:

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');

How do I change both the default font color and font family of text entered into the editor?

  • 写回答

1条回答 默认 最新

  • dpq755012465 2013-08-05 07:04
    关注

    Create my-editor-style.css stylesheet in your theme root folder and put your styles there:

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

    And finally load this file by adding following hook into your functions.php file:

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

    Read more about editor styles in codex.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?