Prevent backlight from contacting fontawesome.com

The best way is to make a child theme. That way, when there’s a backlight update, it would not overwrite your changes. Looking at the source code, Matt already designed the Backlight theme to have a custom fontawesome loader :slight_smile: This means that you don’t need to add anything to your theme’s functions.php file.

There are many tutorials out there to make a child theme. This one is from Wordpress: Create a Child Theme – WordPress.com Support

As far as I remember, here are the minimal steps to create a child theme. The code shown is based on what I’m using on my site. Assuming your Backlight theme name is bl_theme, I would call the child theme bl_theme_child

  1. Make a directory in blog/wp-content/themes/bl_theme_child. This assumes that the Wordpress installation is in /blog, change this according to where you have WP installed.
  2. In the child theme directory, create a file style.css with following content:
/*
 Theme Name:   Backlight Theme Child
 Template: bl_theme
*/
  1. In the child theme directory, create the file functions.php with following content
<?php
function bl_theme_child_enqueue_styles() {
	// Add local style
	wp_enqueue_style('child-theme', get_stylesheet_directory_uri() .'/style.css', array('parent-theme'));
}
add_action( 'wp_enqueue_scripts', 'bl_theme_child_enqueue_styles' );

// Add font_awesome
function font_awesome() {
	// echo your code for local Font Awesome resources.
}
add_action('wp_footer', 'font_awesome', 22);

?>

Obviously, you still need to add your local font awesome code.

  1. Select your new child theme in the Wordpress backend.

This is what I’m basically using right now. Looking at some of the tutorials out there, there are many other options that might be of value. But this seems to work for me :wink:

Hope this helps!

3 Likes

Daniel,
thanks for your detailed explanation.
:+1:

Best regards,
Oliver

Please let me know if it works for you!

Rod, I went to your page and followed the instructions for loading FA locally. I turned on the “Load Font Awesome resources locally” by selecting yes. Your page says Backlight will create a folder “fontawesome” inside the backlight/custom/ folder. Is this only AFTER the new version is installed? I’m on framework 5.1.1 and when I did the above, it did not create the fontawsomefolder. Is this whole thread something I have to do when the new modules come out, and when they do come out, does font awesome pro (“fa”) have to be changed or will it continue to work as in the past? Also, I use a google font, “Quattrocento sans” that has a stylesheet link to

https://fonts.googleapis.com/css?family=Quattrocento|Quattrocento+Sans&display=swap

Is that a problem as well?

@michaelboatright Don’t worry about doing this right now. We have an update releasing soon that revamps Font Awesome to no longer use a CDN.

1 Like

When I enabled that feature, the folder was created.

But Matt’s about to release the update that will load Font Awesome 5 Free locally. In fact, the update removes the option to load locally, it just will be.

If using the far prefix, you may need to change it to fas.

More on that in this thread: Upcoming Changes to Font Awesome

Thanks…I read that. What about fa & fab? Quattrocento & Quattrocento+Sans?

I don’t know. Check the Font Awesome site to see if those are included in Font Awesome 5 free version.

OK, it was a bit of a dumb question. It looks like some far (fa-regular) icons, such as far fa-envelope are included in the free version as well as some fab (fa-brands): fab fa-instagram, fab fa-facebook, fab fa-linkedin and fab fa-youtube that I use.

Backlight 5.2.0 is now live.

2 Likes

I just noticed in my Backlight WordPress theme pages, the Font Awesome use in the parent menu is showing [?] instead of the \f107.

Yet when I go to a Backlight photo page (published via Lightroom), those pages do have the right icon. It’s only the pages in the WordPress theme that are broken.

More crazy, when I’m logged into my site’s WordPress backend the menu icon is shown correctly. It’s only when not logged in.

I searched around trying to sort this out and just gave up. So here I am, asking the group.

Why does the WordPress theme pages for Backlight 5.0.3 have the broken Font Awesome in the menu?

I’ve updated all the modules, which are mostly 5.4.0. My photo pages are a mix of Pangolin modules 5.0.1, 5.0.7, 5.3.0 (that’s what I get after the update).

you can find what I’m seeing at reekes.net (try Home and then Photography). Works under Photography which are Pangolin pages. It’s broken under all other pages, which are Backlight WP Theme pages.

Hi Jim,

Are you using the latest version?

The Turning Gate’s blog includes the FontAwesome CSS:

<link rel="stylesheet" id="fontawesome5free-css" href="https://backlight.theturninggate.net/backlight/modules/module-admin/lib/css/all.min.css?ver=6.2.3" type="text/css" media="all">

However, I’m not seeing that asset in your page source. Did you replace the HEAD section of the page with your own?

I also notice a missing icon in your albums in the large image display. The image menu icon in the upper right shows the unicode rather than the image icon.

have you tried clearing template cache?

I had a similar issue with WordPress sites not long ago. Turned out that I was using a different site url in the WordPress settings than what my Backlight site url was set to.
(mainly the difference between the subdomain url and the simpler url I assigned: ttg-tips.barbeephoto.com vs ttg-tips.com, for example) or my main site, which can be reached at barbeephoto.com or rodbarbee.com.

Anyway, I needed to reconcile those.

So I’m wondering if your Backlight site URL exactly matches the Site Address URL in WordPress general settings. e.g. http:// vs https://

Are you using the latest version?

There’s no option to update the modules, so I’m assuming I do have the latest. I noticed the problem after updating a couple days ago. Here’s the main modules and versions…

module-framework 5.4.0
module-admin 5.4.0
module-designer 5.4.0
module-publisher 7.4.0
module-pages 5.0.2
custom-resources 5.3.3
pangolin-wordpress 5.0.3

I’ve tried clearing the cache and exporting the them to WP.

Turning Gate’s blog includes the FontAwesome CSS

No idea what’s going on there. I think this is the root cause.

Did you replace the HEAD section of the page with your own?

Nope. It’s all entirely being created by Backlight. I haven’t changed anything within WP (not that I can recall). Searching through all the settings in both BL and WP I don’t see how/why there’s a problem.

menu icon in the upper right shows the unicode rather than the image icon

Where? I can’t find this one. I only see this problem on the WP theme pages, not in the BL photo pages.

Backlight site URL exactly matches the Site Address URL in WordPress

They’re the same, and that hasn’t changed in years.

In Backlight the WP theme advanced option for “Font Awesome Version Support” is set to true. I also tried false (then flush/export), but it didn’t change anything. I even added flushing my site’s cache after the change.

My site’s functions.php only enqueue the BL styles for the chile theme. I also try activating the BL theme directly.

I found another problem with FontAwesome at the bottom of Jim Reekes Résumé | Jim Reekes. The 3 buttons used to have icons, but only 1 does now. There’s a ::before for the button text that was inserting an icon, but that’s also broken? I think that’s another issue about FontAwesome I don’t understand.

The only real change that’s happened in years is updating BL. I suspect I missed this change some time ago (last year?). All the caching in browsers, servers, … and I probably missed it. Just noticed it the other way when I did an BL update.

PS – hmm, seems like the site isn’t getting CSS files. In BL I created a jim-style.css but don’t find it being copied to the WP Theme. Also sounds like what Matt pointed out about the missing FontAwesome CSS file.

This is a strange clue. When I’m logged into WP the CSS files are there. But when I log out, or use a private browsing window, the CSS is missing. Chrome security biting me?

Hmm, do I need to setup a free account at FontAwesome, and then download their kit, and so on and so on? I tried following what they are saying about getting fonts but I got lost. I haven’t been paying attention to them, but it seems they completely changed their world.

Do I need to use their plugin, add scripts or something? I only have a few icons I’m using.

I’m seeing this in Firefox.

In Chrome, the space is blank but if you hover over it, you can see there’s something that’s supposed to be there.

image

same thing is happening in Firefox. Using the browser inspector, I can see your jim-css.css in the Style Editor (Firefox) but it doesn’t show up for the WP based pages.
Check the page template you’re using for the WordPress theme. I custom css enabled in the Advanced Setup section of the page template?

Oops. forgot about your clue regarding the css showing up while logged into your WordPress installation.

You shouldn’t have to do that. Other than my own screw up I mentioned above, the icons are showing up in my blog and also in my WordPress based ttg sites.