How to Add Custom CSS Styles to WordPress Post Editor

How to Add Custom CSS Styles to WordPress Post Editor
How to Add Custom CSS Styles to WordPress Post Editor

You can add editor styles and change the WordPress Post Editor look with Custom CSS styles and create a pleasant writing experience that suits your eyes and makes you enjoy writing more than ever. I have been using white text on black background in post editor because it makes me work better… and you can also customize what works best for you.

Custom Styles in WordPress Visual Post Editor

Lets see what mine (and yours) WP post editor screen looks like now in Visual Post Editor

Now as I start to use this feature, it can change and make me use the style I love.

See how I now get a dark background which I like. I have customized a wide margin to have wide space around my text and links with green!

Add Custom Editor Styles

To get started – first, you need to enable the functionality in your WordPress themes. If you are using a new theme or  a recently updated WordPress theme, then this  functionality has recently a required feature for getting theme approvals

Step 1 – First, you need to add_editor_style function by adding the following code in your theme functions.php file. [Remember this is a powerful file and the wrong code can make your site offline. Always backup this file and it will need to be restored by FTP if something goes wrong.]

function qot_add_editor_styles() {
add_editor_style( 'custom-editor-style.css' );
}
add_action( 'after_setup_theme', 'qot_add_editor_styles' );

Step 2 – After that you need to add a file called custom-editor-style.css (or any other name you like you can change here) in your theme folder. It can be easily done via or FTP of by creating new files without FTP also.

Step 3– Now once both steps are completed you are set to add CSS code to your CSS file and it will change the way your WordPress post editor looks. Here is what we added in  custom-editor-style.css to get this look.

The above code makes the background black, makes the text on it light grey and adds a nice margin around the text so it does not flow into the borders giving ample blank space. It also changes the fonts and link colors to my liking.

Import Custom Style.css

If you use a highly custom CSS,  you will realize that what you see in the WordPress post editor is actually not what is displayed on the live website once the post is saved or updated.  For example, I really cannot make out the custom link color as it appears in the post text.

So here is the fix that based on the similar example above –  you basically need to import the CSS URL into the editor stylesheet, instead of adding the CSS code.

@import url("https://sitename.com/wp-content/themes/themename/style.css");

After you save the changes, it is very important to clear your browser cache as well as clear the WordPress cache, else you will notice no changes!  After that, once you reload the WordPress editor again, you will see the same styling as that on your website. 

>> Here is how you can import Bootstrap CSS and Font Awesome Icons in a similar manner.

Does it affect Page speed? This custom editor CSS file does not load on the main blog pages, so it does not contribute to slowing speeds on page speed tests. However, if you load large CSS imports, you might notice a slight increase in Post editor load times till the text becomes visible as it will load these custom CSS before the text loads.

Basically, the WordPress post editor by default mimics the post content as it would be finally posted, but this custom editor-style helps to override the main blog CSS files to add a custom experience to your writing style. Note This will change the look of the Visual editor and not change the display of the Text Editor. Experiment with post editor styles and I am sure that after using this tip,  you will be more inclined to write better.

Source – https://www.quickonlinetips.com/archives/2020/02/add-custom-css-wordpress-post-editor/

RSS Latest Press Release

  • Confort Prestige | Climatisation & Chauffage Announces HVAC Services For Improved Energy Efficiency
    TERREBONNE, QUEBEC- NOVEMBER 14, 2021- Premier heating and cooling company Confort Prestige is excited to share HVAC solutions with domestic customers in the Terrebonne area. These services aim to save customers money on their heating and cooling expenses throughout the year.   Since its debut, Confort Prestige has been committed to customer service. This starts […]
  • Hundreds of Car and Truck Parts Available from Salvage Specialist
    Morganville, NJ – When it comes to finding an auto part for a foreign or domestic vehicle, Trilenium Auto Salvage usually has the answer.   The Morganville, NJ salvage specialist has hundreds, if not thousands, of parts and components at its Tennent Rd premises available.   Trilenium Auto Salvage is one of the busiest salvage specialists […]
  • Flowsent Weed Delivery Offers the Fastest Weed Delivery Service in the Bay Area
    Bay Area, CA - As it becomes easier to get cannabis in different stores and online, weed delivery in Oakland, San Francisco, and other Bay Area cities are becoming more common. People are looking for the easiest way to get their hands on high-quality, safe cannabis, and nothing beats direct to your door.    Many […]
  • Cannamazoo Now Offering the Top Cannabis Concentrates in Michigan
    What are Cannabis Concentrates, Oils, and Extracts?   Kalamazoo, MI - You may be familiar with recreational cannabis in its usual form, but have you ever tried extracts, oils, and concentrates? Each of these forms offers unique effects and benefits that smoking cannabis flowers can't provide. Simple dosing, cleaner effects, and better taste are just […]