Again within the early days, icons had been readily to be had, however enforcing them successfully in WordPress used to be a little harder. It’s essential to get round some problems with sprites, however they weren’t at all times a great way ahead, and as retina displays began popping out, the issue used to be magnified (somewhat actually).

Some of the commonplace answers to this drawback is to make use of an icon font. Icons are internet fonts or vectors, so you’ll scale them infinitely and a large number of icons can have compatibility inside of a unmarried record, bringing down your request depend significantly. This permits you to use nearly any icon you’ll most likely dream up. Then again, with this, additionally comes some efficiency concerns.

We’ll display you on this article a pair alternative ways to make use of WordPress icon fonts, the place to get them, and which means may well be the most efficient on your website.

Nonetheless searching for that best WordPress host?

Check out Kinsta’s top rate controlled WordPress website hosting to revel in your website with out issues.
  • Styleized controls representing management
    Totally controlled
  • Shield with a tick representing securitySafe like Citadel Knox
  • Merging lines representing migrationsUnfastened migrations
  • Three right chevrons representing server speedFinal velocity
  • Circular arrow with center dot representing backupsDay by day backups
  • Offset hexagons representing our server stackGoogle Cloud Platform

The place to To find Icon Fonts

There are a large number of nice puts to now to find icon fonts on your WordPress website. Simply sort “icon font” into Google will yield you some nice effects. Some of the standard and broadly used ones is Font Awesome. As of scripting this, it has 1,400+ unfastened icons, in addition to 4,500+ icons of their professional model. It contains icons for nearly the whole lot, from interface, to social, arrows, and lots of different sorts of icons.

Font Awesome icons

Font Superior icons

Listed here are a couple of different ones to take a look at:

  • IcoMoon is any other standard provider with 5,500+ unfastened vector icons and four,000+ top rate icons. If truth be told, we’ll be the use of their icon font generator instrument additional under.
  • Fontello is any other nice provider that is helping you find and constructed icon fonts.
  • In case you’re searching for an excellent light-weight icon set, make sure that to take a look at Bytesize. All 84 icons measure in at 9KB minified (2 KB in SVGZ, or Gzipped).
  • In case you’re short of to easily use SVG icons manually, you received’t discover a higher top rate library than Iconfinder.

Fast and Simple Techniques to Use WordPress Font Icons

First we’ll dive into one of the crucial fast and simple tactics to make use of WordPress font icons. Truthful caution, now not all of those are the most efficient in relation to efficiency. For that, we advise skipping all the way down to the segment at the best method.

Choice 1 – Use a WordPress Plugin

The fastest approach to stand up and working with WordPress font icons is to easily use a third-party plugin. The unfastened Font Awesome Integration plugin accommodates the most recent Font Superior 5 icon library. After you put in and turn on it, all it takes is an easy shortcode code to insert an icon. They also have a WordPress icon now! Lovely cool.

You’ll be able to take a look at Font Superior 5’s basic use chart for added tactics to make use of and customise it, in addition to their icon library. As an example, under we inserted the WordPress Font Superior icon in a Gutenberg shortcode block and added fa-3x to make it thrice larger.

[fawesome iclass="fab fa-wordpress fa-3x"]
Font Awesome shortcode in Gutenberg

Font Superior shortcode in Gutenberg

Here’s what it looks as if at the front-end. Lovely simple proper? We had a Font Superior icon up and working on our website inside of only a few mins.

Font Awesome example in WordPress 5.0

Font Superior instance in WordPress 5.0

If you wish to have a large number of simple to make use of shortcodes, chances are you’ll need to additionally take a look at the Shortcodes Ultimate plugin. They have got a top rate icons add-on you’ll use.

The above is a brilliant resolution if you wish to let your purchasers upload icons to posts or pages, however if you wish to use those parts inside of your theme or plugin it’s best possible to enqueue them your self (will dive into this additional under).

Choice 2 – Use the Integrated Dashicons

Dashicons is a collection of font icons incorporated by means of default since WordPress makes use of it at the backend. You’ll wish to enqueue it at the front-end, however all you want is the title of the script, the record is already to be had to WordPress.

You’ll be able to upload the next for your purposes.php record, or we advise the use of a unfastened plugin like Code Snippets. This minimizes the danger of breaking your theme and the adjustments can also be continual during theme updates.

serve as my_theme_styles() {
wp_enqueue_style( 'dashicons' );

You’ll be able to then pass to the Dashicons website, choose an icon and click on the “reproduction HTML” hyperlink which offers you the code you want to show the icon. They don’t have an enormous variety, however they nonetheless paintings nice and are very light-weight.

As an example, under we inserted the dashboard icon in a Gutenberg HTML block.

Dashicons in Gutenberg HTML block

Dashicons in Gutenberg HTML block

Here’s what it looks as if at the front-end.

Example of Dashicons in WordPress 5.0

Instance of Dashicons in WordPress 5.0

Dashicons doesn’t have any cool shortcodes with it out of the field, however you’ll customise the scale of your icons with CSS. Here’s an instance of placing an icon proper sooner than a header.

My Cool Headline

Choice 3 – Manually Hyperlink to Externally Hosted Icon Fonts

Your 0.33 possibility is to manually hyperlink to externally hosted icon fonts. That is necessarily what the plugin in possibility 1 above is doing in the back of the scenes.

For Font Superior, you’ll take hold of the code from their Start page after which apply the stairs under. They host all in their fonts on a CDN free of charge for you. It’s going to glance one thing like this:

Step 1

Reproduction the code into the of every template or web page for your WordPress website the place you wish to have to make use of Font Superior. You’ll be able to edit your theme’s header.php record or higher but, apply our easy instructional on how to add code to your header.

Step 2

You’ll be able to then get started hanging icons on your HTML’s . Find the right icon and discover ways to add it onto your page.

Efficiency Factor to Imagine with The use of Icon Fonts

Whilst there may be not anything incorrect with the use of one of the crucial above tactics so as to add icon fonts for your website, they aren’t technically the easiest way. Why? All of it comes all the way down to efficiency problems.

You Almost certainly Don’t Want All The ones Icons

First off, while you use a plugin for icon fonts or hyperlink to an exterior icon font library, it’s going to load the entire icons in its complete library. In case you’re simplest the use of 20 or so icons during all of your website, this can also be treated in a a lot better means.

As an example, we incorporated the Font Superior 5 library on our website and whilst the CSS record for it’s small, the font record itself is 108 KB. Whilst this would possibly now not appear that massive, you’ll see additional under how small the record in reality will get after we select simplest the fonts we in reality are the use of.

Large Font Awesome library

Massive Font Superior library

Loading From One CDN is Typically Sooner

2d, there may be not anything incorrect with loading scripts from other CDNs. Then again, in case you have the solution to load it from one CDN, that is most often sooner. Why? As a result of it may well benefit from a unmarried HTTP/2 connection and decreases further DNS lookups. Simply make sure that your primary CDN is a great one!

Host Icon Fonts In the neighborhood (Most effective the Ones You Want)

On account of the efficiency causes discussed above, we’re going to stroll you thru how one can host your icon fonts in the community, in addition to simplest the use of those you want. Through in the community we imply both loading them out of your WordPress host’s server or your personal CDN.

Through opting for simplest the icon fonts you want, this will deliver down the record dimension from 100 KB to a few kilobytes, beautiful to hand! Even higher: you’ll even mix’n’match icons from quite a lot of font units.

The Fundamentals – The way it Works

The use of a font icon comes to website hosting the font record (WOFF, WOFF 2, and so on.) for your internet server, then the use of CSS to load the font face, then developing some markup so as to add the icons in the proper position.

Whilst your website will load a unmarried record, you’ll in reality finally end up having plenty of record codecs for every font since some browsers make the most of other codecs. Font Superior has 6 other record codecs incorporated: EOT, SVG, TTF, WOFF, WOFF 2 and OTF. Then again, in keeping with browser enhance you in reality simplest want WOFF or WOFF 2.

Tip: WOFF is supported by means of 93%+ of all fashionable browsers. Then again, WOFF 2 is compressed extra, however is simplest supported by means of 83%+ of all fashionable browsers. We advise opting for one or the opposite or each. The browser will decide in keeping with your code which one to ship as much as the customer.

Your first activity is to make use of a device to make a choice simplest the icons you wish to have. You’ll be able to then upload those recordsdata for your mission listing someplace, most often in a fonts listing.

Subsequent, you upload the Font Superior CSS record into your mission and upload it for your web page the use of a typical previous hyperlink part.

It’s essential to additionally enqueue the CSS record or if it’s small, merely use it inline.

In case you have a look at the CSS record you’ll see what’s occurring within the background. The font recordsdata are loaded, the fundamental part with the category of .fa is outlined (in conjunction with some others), and in spite of everything, every named icon is outlined (eg: .fa-book).

The one factor you want to consider of is the trail for your font recordsdata. Through default, they’re loaded from ../fonts which would be the fonts listing, one folder up from the present CSS record. Chances are you’ll wish to alternate this to suit your personal listing construction.

Now that you’ve got a greater thought of the way it works, we’re going to upload stroll you thru how one can do it step-by-step. On this instance, we’re the use of a manufacturing ecommerce website.

Step 1

First, you will have to decide which font icon library you wish to have to make use of. We shared a couple of we adore at first of this newsletter. On this instance, we’re going to be the use of Font Superior in conjunction with the IcoMoon font generator. If you wish to have the WOFF 2 recordsdata from IcoMoon, you do need to pay a one-time charge of $9.00 to get entry to their top rate library.

You’ll be able to obtain the Font Superior icons you wish to have manually free of charge, however you would have to use a device like FontForge to manually edit their WOFF or WOFF 2 record. We’re all about simple, so we’re the use of a generator.

Step 2

Head over to the IcoMoon generator. We click on “Upload” at the Font Superior library.

IcoMoon Font Awesome library

IcoMoon Font Superior library

Step 3

Subsequent, you’ll need to pick out the icons you wish to have to make use of for your WordPress website. If you’re already the use of Font Superior and are merely transferring to in the community hosted variations, undergo and make a brief record after which select them from the library.

Choose Font Awesome icons

Make a choice Font Superior icons

On this instance, we’re selecting out icons for, a WordPress ecommerce website which runs Simple Virtual Downloads.

Step 4

If you’ve picked out all of your icons, select “Generate Font” on the backside. For this website, we ended up desiring 20 icons.

Font Awesome icons from IcoMoon export

Font Superior icons from IcoMoon export

You are going to finally end up with recordsdata that seem like this. The necessary ones you’ll want is the taste.css record and the font recordsdata (WOFF, WOFF 2).

Font icon files

Icon font recordsdata

Step 5

Subsequent, it’s really helpful you carry out a to find and change within the taste.css sooner than you add/reproduction it for your website. Here’s what the unique one looks as if.

Suffering with downtime and WordPress issues?

Kinsta supplies an all-in-one website hosting resolution designed to save lots of you time! Allow us to deal with the nitty-gritty stuff (caching, backups, and so on.), and also you focal point on what you do best possible, which is rising what you are promoting.

Check out our features

IcoMoon CSS file

IcoMoon CSS record

For the ones of you already the use of Font Superior, this merely makes it more uncomplicated to switch the categories over to Font Superior ones, this fashion if there used to be one thing already coded for your WordPress website with it, it is going to robotically get started the use of the icons.

So do a To find for “icon” and change the entire occurrences with “fa”. You will have to be capable to do a handy guide a rough to find and change with a textual content editor like Chic.

Find and replace in Sublime

To find and change in Chic

This replaces [class^="icon-"], [class*=" icon-"] with [class^="fa-"], [class*=" fa-"]. It additionally fixes every icon, so as an alternative of beginning with .icon-, they now get started with .fa-.

You may additionally wish to alternate the supply URL in keeping with the place you add your font recordsdata down in Step 7. We advise converting the URL for your CDN.

Step 6

Subsequent, you want so as to add the CSS for your website. There are a pair tactics you’ll do that.

Choice 1

Because the quantity of CSS may be very small, it’s worthwhile to reproduction the entire record’s CSS and paste it into the WordPress Customizer. By no means do that for enormous recordsdata, however it is a moderately small quantity of CSS. This implies it is going to load inline for your website.

Choice 2

It’s essential to hyperlink for your stylesheet manually by means of hanging it within the header of your WordPress website. Tip: Hyperlink to it by yourself CDN for sooner efficiency.

Choice 3

It’s essential to additionally enqueue the CSS record in WordPress. The method is similar to the handbook means. Upload the next for your theme’s purposes.php record, or use the unfastened Code Snippets plugin. Chances are you’ll wish to alternate the listing in keeping with the place you add it.

serve as my_theme_styles() {
wp_enqueue_style( 'FontAwesome', get_template_directory_uri() . '/css/taste.css' );

add_action( 'wp_enqueue_scripts', 'my_theme_styles' );

Step 7

Now that you’ve got the CSS added for your website, it’s time to add the font recordsdata. You’ll be able to put the fonts any place, a folder known as “fonts” on your /public at once is ok. Keep in mind even though, the supply folder on your taste.css record wishes to compare.

Icon font files SFTP

Icon font recordsdata SFTP

Step 8

Now your WordPress website will have to have each your CSS and font recordsdata obtainable. So subsequent, you’ll upload some markup for your website. That is simply an instance of including a cog icon.

You’ll be able to see a reside instance of this running over at Remember that you’ll use any part, now not simply i. You’ll be able to use common span parts as neatly, along with including CSS for your customized categories.

Font Awesome example on Perfmatters

Font Superior instance on Perfmatters

The actual distinction is while you check out the scale distinction. Keep in mind, after we connected to the Font Superior exterior library, the full dimension of the font record used to be 108 KB. Once we used a font generator and selected simplest the Font Superior icons we wanted for the website, it introduced the font record down to two.6 KB. Our font record lowered in dimension by means of a whopping 97.59%!

Size of WOFF 2 Font Awesome file

Dimension of WOFF 2 Font Superior record

Now not simplest that however it now additionally rather a lot from our CDN, this means that there are no further DNS lookups to

Icon Fonts Accessibility Issues

One problem of icon fonts is their terrible accessibility. Display readers might skip them, or worse but, learn the unicode or the nature itself. This is able to lead to visually impaired folks listening to “yellow celebrity favourites” when taking a look at your favourites menu merchandise – now not best. You will have to additionally consider what occurs if the fonts don’t load.

Preferably, you could possibly need ornamental icons to easily disappear when now not loaded and significant icons to get replaced with textual content if there is a matter.

The accessibility factor is rather simple to care for, merely use the aria-hidden="true" parameter and price to signify to display screen readers that they will have to discard our part.

 My Favourites

In a extra entire implementation, you’ll additionally use Modernizr to check for font face enhance. You’ll wish to regulate the CSS quite, see the very good Bulletproof Font Icons article for extra in-depth data.

For details about developing essential icons with textual content fallback, we’d additionally counsel studying the thing above, they have got defined and solved the problem as best possible as imaginable, however enforcing this can be a bit out of the scope of this newsletter.


That’s all there may be to icon fonts. Now you understand a few alternative ways to simply get icon fonts for your WordPress website, alongside the easiest way to put in force them on the subject of efficiency.

We at all times counsel the use of a font generator to construct an icon font that is composed of simplest the ones icons you employ. This may occasionally make your theme significantly extra streamlined! When you have a favourite library or generator that we didn’t point out, please us know. There are an even collection of just right ones in the market!

The put up How to Use WordPress Icon Fonts the Right Way (Better Performance) seemed first on Kinsta Managed WordPress Hosting.

WP Hosting

[ continue ]