Make the Editor Match Your Classic Theme
Loads an editor-style.css file from your (child) theme into the block editor and turns on editor styles, so posts look the same while writing as on the site.
Opens WPIDE on
Code
// File name inside the active theme folder.
$wpide_editor_style_file = 'editor-style.css';
add_action( 'after_setup_theme', function () use ( $wpide_editor_style_file ) {
if ( wp_is_block_theme() ) {
return;
}
if ( ! file_exists( get_stylesheet_directory() . '/' . $wpide_editor_style_file ) ) {
return;
}
add_theme_support( 'editor-styles' );
add_editor_style( $wpide_editor_style_file );
}, 20 );
Notes
Create editor-style.css in your theme folder with the typography and colors you want in the editor. Block themes do this automatically.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.