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

Import Bootstrap CSS, Font Awesome Icons in WordPress Visual Post Editor
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

</span>

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

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

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 2 – So 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("https://sitename.com/wp-content/themes/themename/css/bootstrap.min.css");
@import url("https://sitename.com/wp-content/themes/themename/font-awesome/css/all.css");

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("https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css");

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.

Source – https://www.quickonlinetips.com/archives/2020/02/bootstrap-font-awesome-in-wordpress-visual-post-editor/

RSS Latest Press Release

  • Dômes Clim Services Delivers Consistently High Quality Plumbing Solutions
    Clermont-Ferrand, France – Plumbing repair specialist Dômes Clim Services is quickly becoming the go-to solutions provider in Puy-de-Dôme department for commercial and domestic clients thanks to its high-spec services.   As a well-regarded plumbing repair and installation company, it always puts customers first in delivering a host of options and to minimize the impact on their lives […]
  • Smart Toilet Market Size to Reach $15181.4 Million by 2027
    Global Smart Toilet Market is valued at USD 7452.1 Million in 2020 and Anticipated to reach USD 15181.4 Million by 2027 with a Growing CAGR of 10.7% over the forecast period. Global Smart Toilet Market: Global Size, Trends, Competitive, Historical & Forecast Analysis 2021-2027, Rising adoption of innovative hygiene technologies such as UV lighting, supportive […]
  • Ideal Keepsake Boxes Add an Extra Touch to Saving Beautiful Memories
    Dallas, TX: November 29, 2021 – Family business Wayfaren is delighted to announce the release of its beautifully understated Keepsake Boxes - an ideal gift for loved ones to safely store treasured memories.   Their Keepsake Boxes, available in either maple or walnut, are thoughtfully designed and meticulously crafted for those who don't want to sacrifice style […]
  • Guru Printers Provides Exceptional Service in Sheet Labelling
    Los Angeles: November 29, 2021 – When it comes to branding your business in the right way, Guru Printers have developed a series of eye-catching solutions to enable companies to stand out from competitors.   With over a decade of printing experience, the Los Angeles-based company has created a robust line of printing services to meet […]