[How to] Add Editor Style To Your Theme
WordPress allows theme developers to define custom CSS styles for visual editor on the post edit screen. Although, this theme development stage is often skipped by developers, it is very critical for end users to feel home when they are composing amazing posts.
To add editor style to your theme, all you have to do is to add add_editor_style call in your Theme Setup function like in the example below:
function wpa_theme_setup(){ ... add_editor_style(); ... } add_action( 'after_setup_theme', 'wpa_theme_setup' );
When you add this call in your theme setup, WordPress will look for editor-style.css
in your theme directory and it will use it for the visual editor styles.
If you want to give your editor stylesheet a custom name, you can also pass this name as a string to the function:
add_editor_style( 'styles-for-editor.css' );
I hope you liked this tip. If you want to get more tips like this, please don’t forget to subscribe to our weekly tipsletter! All the best,
WP Assist Team