Import Bootstrap CSS, Font Awesome Icons in WordPress Visual Post Editor

How can you view Bootstrap CSS styles and Font awesome icons in your WordPress visual post editor? Currently, if you use these 2 essential design elements, the changes are not visible in the WordPress visual post editor, and you need to preview the post live to see the changes. This makes effective implementation difficult as you need to constantly keep switching. Is there an easier way?

Import Bootstrap CSS / Font Awesome Icons

Bootstrap is the best front end mobile-first tool to develop great responsive websites, and we now use it on all our website designs. Font Awesome is a great icon font that loads super fast and is a useful way to replace all icons and icon images on your site. If you use Bootstrap Themes like Quickstrap, you will realize that 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 blockquote test as it appears similar to the other post text. So how can you get the WordPress visual editor to display bootstrap CSS or add Font Awesome icons such that the styling appears similar to what it would appear in the actual post? 

For example, here is what we are trying to do –  insert a simple button powered with both tools. The button is drawn by Bootstrap and the thumbs up icon by Font Awesome.

<span class="btn btn-lg btn-success">
<i class="fas fa-thumbs-up"></i> LIKE

This is how typically this code would like in your WordPress Visual Post Editor

nostyle wordpress editor

And this is how it looks like in my Visual Post editor right now.

bootstrap in wordpress editor

Add Editor Styles

Step 1 – First you need to add editor styles step-wise as I explained in the last post. Then if you have used that post tips to enable the custom styles for your post editor, then I assume you already have the WordPress function in functions.php in place and a custom-css-styles.css file in place.

Import Bootstrap CSS

Step 2So here is the fix that based on a similar example in the previous article, that you basically need to import the CSS URL into the editor stylesheet.

@import url("");
@import url("");

Clear WordPress Cache

Step 3 – 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 similar Bootstrap or Font Awesome Icons or custom styling as that on your website. Simple. Done!

Fix for Bootstrap CDN?

Many bloggers like to use free CDN to import Bootstrap CSS or Font Awesome CSS. You can use their CDN URLs instead of linking to CSS on your site server for faster load times. For example.

@import url("");

Now when you place Bootstrap code or Font Awesome in your WordPress posts, you need not preview it every time, simply view it live in your WordPress Post editor. Enjoy.

Share with friends

About the Author: P Chandra is editor of QOT, one of India's earliest tech bloggers since 2004. A tech enthusiast with expertise in coding, WordPress, web tools, SEO and DIY hacks.