title

Set different editor stylesheets for different post types

 

Set different editor stylesheets for different post types

11 Mai 2013, Posted by antoine in

With the following code pasted into your functions.php file, you can setup different editor stylesheets for different post types. You will need to adapt it, depending on your post types, and remember to change the stylesheets names as well.

function my_editor_style() {
    global $current_screen;
    switch ($current_screen->post_type) {
        case 'post':
        add_editor_style('editor-style-post.css');
        break;
        
        case 'page':
        add_editor_style('editor-style-page.css');
        break;
    
        case 'portfolio':
        add_editor_style('editor-style-portfolio.css');
        break;
    }
}
add_action( 'admin_head', 'my_editor_style' );