Using Font Awesome in your Backlight site

All those icons you see throughout your site: the little down arrows in navigation, the side arrows in breadcrumbs, the social media icons and the icons in the image menu of a standard album slide show, nearly all of them come from Font Awesome.

And Matt has licensed Font Awesome so that we, the users of Backlight, may use any of the Font Awesome 5 icons that we like.

So first, what is Font Awesome? It’s a collection of icons that you can use virtually anywhere on your site. Just go to the Font Awesome site and have a look around.

And second, where would you use them? Good question. The answer: lots of places throughout your site. How about your navigation menu. Would you like a house shaped icon to go along with the word “Home” in your menu? You can do that.

What if you want to change the map icon in your galleries? You can do that.

I’d first like to note that if you have updated from Backlight 2 to Backlight 3 and you’re having issues with icons on your site not appearing correctly, try editing your page template. Go to Design > Advances Setup, and under Font Awesome Version Support set Enable shims for Font Awesome 4 to ON.

Changing or adding Font Awesome icons by changing or adding html

The Client Response add-on makes wide use of Font Awesome icons. In the Client Response add-on settings you can choose, via drop-downs, the icons used for Image Selects and Image Feedback.

image-selects
image-feedback

Font Awesome icons are also used in the built in Gallery Help. Just scroll to the bottom of the template add-on to see the html in the Content / Legend / Help (md) field.

However, the icon code used there is based on the defaults chosen for the Client Response add-on. For example:

<div class="col_6 alpha">
<p><strong>In the image grid</strong>:</p>
<ul class="fa-ul">
<li><i class="fa-li far fa-heart"></i>Unselected Image; click icon to select</li>
<li><i class="fa-li fas fa-heart" style="color:#f44336;"></i>Selected Image</li>
<li><i class="fa-li fas fa-comments"></i>Leave feedback on an image</li>
</ul>
</div>>

The first two “heart” icons are for the selection icon in each thumbnail in the grid. The first (far fa-heart) is the outlined heart. The second (fas fa-heart) is the solid heart that appears when you click on the outlined heart to select the image.
(The fa-li preceding the icon code makes the items list items. This makes it so they act like list items and align as such.)

Like I said, the code in the Gallery Help reflects the template’s default settings. If you change the select icon to, say “Check Square,” the code in the Legend/Help section does not change. You will need to change the Font Awesome code to match your icon selection in the template.
Say you do change the Select icon to Check Square, then head over to the Font Awesome site and find the icons that match what you’ve chosen (search for “square”). For the square outline you’ll want “far fa-square” and for the checked square you’ll want “far fa-check-square.”

Then just change the code in your album template:

<div class="col_6 alpha">
<strong>In the image grid</strong>:
<ul class="fa-ul">
<li><i class="fa-li far fa-square"></i>Unselected Image; click icon to select</li>
<li><i class="fa-li fas fa-check-square" style="color: #f44336;"></i>Selected Image</li>
<li><i class="fa-li fas fa-comments"></i>Leave feedback on an image</li>
</ul>
</div>

Do the same thing with any other icons you need to change.

What if you want icons in your navigation menu? Just go to the Font Awesome site and find what you need. Then copy the html and insert it before or after the text in your menu item.
Want a house shape for the Home item? From the Font Awesome site, the html is:


<i class="far fa-home"></i>

In your menu set, in the Home page text, place that code and the word “Home.” Separate the two with a space.

And this is what it looks like in the menu:

Custom CSS

For other applications of the icons, making these changes isn’t as straightforward. For example, changing the icons used in albums, either in the Single Image or Slideshow presentations. In those cases, you’ll need to use custom css to make the change. You’ll also need to identify the selector you need to use to apply the custom css.

As an example, you may want to change the default map icon. The icon is applied via css but there is no setting in Backlight to choose the icon. So the first thing to do is to identify the css selector being used to apply the icon. To do this, you’re going to have to use the browser’s built-in inspector. I’ve written some tutorials on using the inspector here and here and to an extent, here.

I use the slide show presentation in my albums, so I’ll use that example. To find the selector using the Inspector, go to where you can see the icon, in this case, that’s the large image view in the slide show presentation.

Right click on the object you’re interested in.

Right-click on the object you’re interested in. Note: if you’ve disabled right-clicking on your site (via phplugins and javascript) you’ll need to get to the inspector through the browser menu and then work your way through the html to the item you’re interested in.

 

In the browser inspector, you’ll see some code highlighted. This may or may not be the exact code that you’re looking for but it will be close. You may need to expand code trees where you see right-arrows.

In this case, the html governing the map icon is the code highlighted. Sometimes you’ll need to dig down a little more. Look for the :before and :after pseudo-elements. The icons are often applied using one of these.

 

The css rule that’s applying the icon

Next, look in the other pane of the inspector where you see the css rules controlling the style.

The content property is what’s inserting the icon:

content: "\f5a0";
You can use this whole rule in your custom css, but you really only need the content property. So copy this rule into your custom css file. If you don’t already have a custom css file, then create one in a plain text or code editor.

The next thing to do is find the icon you wish to use. Head over to the Font Awesome site and search for “map.” You’ll see lots of options. I’m going to go with one of the “globe” options. Click on the one you want and look below the name of the icon to see the codes that will insert the icon. Copy the unicode:

Copy the unicode

Paste the unicode (f57d) into your custom css file in place of the default (f5a0).

.fancybox-pallet .fb-googlemaps > a::after {
content: "\f57d";
}

Save the custom css file and upload it to your server. Go to your site and refresh the browser. Take a look at your new map icon.

You can use these techniques to add or swap out icons in all sorts of places on your site. However, they won’t work for Theater presentations or Galleria or the “Previous” and “Next” buttons in the Pangolin album slide show presentation since those third-party applications aren’t using Font Awesome for controls, etc.

8 thoughts on “Using Font Awesome in your Backlight site”

  1. Rod – I’ve started looking at using some of the icons for my website. Great tool! But I have a quick question for you. When I go to the Font Awsome site most of the icons are faded out and available only to Pro members. Are we restricted to just the free icons or is there a trick to accessing the rest?

  2. Should be all of them. Try it out!
    The reason they’re grayed out is probably because you aren’t logged into their site as a pro member. But you can still access the needed code.

  3. I can’t fathom out how to add a standard Instagram logo to a BL4 design template. Could you help?

    Here’s what I tried: In the “social media” section of the BL4 design template I inserted “” into the “icon” field – I got the code from the Font Awesome website after I’d searched for instagram. I put my instagram account in the “URL” field.

    Here’s what I got: instead of a logo I got “id=”social_media”_01”> as written which is a hyperlink to the correct location (my instagram account.

    How do I get a logo rather than words?

  4. I’m trying to add a simple instagram logo to the top pallet in BL4. Instead of getting a logo I get the words “id=”social_media_01”> appearing in the top pallet. Here is what I tried: I inserted (which I got from the font awesome website by typing instagram in the search field) and in the “icon” field and a link to my instagram account in the URL field.

    The link works fine but I can’t get a logo. What am I doing wrong.

  5. Amendment to last comment: I’m trying to add a simple instagram logo to the top pallet in BL4. Instead of getting a logo I get the words “id=”social_media_01″> appearing in the top pallet. Here is what I tried: I inserted {i class=”fab fa-instagram”}{/I} (I’ve replaced < with { so that it doesn't get translated to html) which I got from the font awesome website by typing instagram in the search field and in the "icon" field and a link to my instagram account in the URL field.

    The link works fine but I can't get a logo. What am I doing wrong.

    1. Just type the word “instagram” (without quotes) into the icon field.
      (See the instructions at the beginning of the Social Media section in the template.)

  6. Oh. Sorry Rod, that was embarrassingly easy. I was following the Font Awesome link and using the instructions there. Thank you. Sorry too for the multiple posts I hadn’t realised he first one had gone through.

    1. the posts required approval first and I approved them all at once. That’s why you didn’t see them.
      all good though!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About this site

This site is: a repository of time-savers and best practices from a user's perspective, picked up from several years of using TTG plugins.
This site is not: a support site.
Read more here.

Subscribe to new posts

Tip Jar

If this site has saved you some time, kept your hair attached, or otherwise prevented you from tossing the mouse through the monitor, feel free to donate.

Categories


Highly recommended. This is my go-to Lightroom book. Click on the book image. (affiliate link)

Affiliate link!

Current TTG versions

Backlight  4 & 5

See the Backlight Modules page on your site for latest Backlight and module versions and changelogs.

You’ll also find the latest version number and download link for the Lightroom Publisher plugin.
(BL 3 and later)

 

Backlight 1 Versions

Backlight 1.2.4
Pages module 1.2.4
Cart Add-on 4.1.7
Client Response Add-on 7.1.3
Theater Add-on 1.2.6
Galleria Add-on 1.0.0
WordPress Add-on 1.2.6
Publisher 3.2.3

Backlight 1 has seen its end of life. See this post.

CE4 Versions

note: CE4 is no longer being developed or sold. See this post.

TTG-BE: 2.0.5a
Autoindex: 7.0.8
Cart: 3.1.4a
CRG: 6.1.3a
Gallery: 6.1.10
Pages: 7.0.15
Publisher: 2.3.3
Stage: 6.1.6
Theme for WordPress: 3.1.2