Font Awesome Support

Font Awesome is an amazing icon based font, which allows you to include social media icons within the font, rather than images. Sure, the font offers additional icons, a full list of all 675 icons in version 4.7 is available. The latest version of the icons, version 5.15.1, offers even more icons.

The snippet below, allows for including support for Font Awesome with your theme or child theme, checking of course to see if the font is not already in use with the theme first, provided it was enqueued properly.

Note: This snippet is for version 4.7.0, with the font-awesome css file upload to the server. There is also a line to replace if you are using the font from a CDN as well.

Snippet

add_action('wp_enqueue_scripts', 'check_font_awesome', 99999);

function check_font_awesome() {

   global $wp_styles;
   $srcs = array_map('basename', (array) wp_list_pluck( $wp_styles->registered, 'src' ) );

   if ( !in_array('font-awesome.css', $srcs) || !in_array('font-awesome.min.css', $srcs) ) {
      wp_enqueue_style('font-awesome', get_template_directory_uri() . '/font-awesome.css' );
   }

}