Insert Font-Awesome icons into WordPress editor

Live previewing content right in the WordPress editor is a cool feature that your themes should have. You can do it easily with add_editor_style function as I already covered in a previous post. This is the simple and easy way to improve user experience by letting users see how posts really look without page builder plugins.

However, what do you think if you can insert and preview Font-Awesome icons when you type? It would amaze your users! Here is an excellent sample from TheFour theme that I'm using for Deluxe Blog Tips (I'm very happy with it):

Fortunately, it's very simple to do that, just with add_editor_style as the following:

add_action( 'init', 'prefix_add_editor_styles' );
function prefix_add_editor_styles() {
    add_editor_style( 'https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css' );
}

Then in WordPress editor, switch to Text mode and insert icon's HTML code. That's easy.

Bonus tip:

If you want to use Google Fonts in WordPress editor, use the similar code:

add_action( 'init', 'prefix_add_editor_styles' );
function prefix_add_editor_styles() {
    add_editor_style( 'https://fonts.googleapis.com/css?family=Lato' );
}

🔥 HOT: Interested in boosting your WordPress SEO? My Slim SEO plugin is a super lighweight and automated plugin that handles most the hard work for you: meta tags, sitemap, redirection, schema & link building.

👉 Have a look and you will love it: wpslimseo.com

Leave a Reply

Your email address will not be published. Required fields are marked *


Copyright © 2024 Deluxe Blog Tips. All rights reserved.

My products: Meta Box | Slim SEO