WordPress – Enqueue Font Awesome
Font Awesome is truly awesome at serving up completely vector based icon fonts that can be called in your WordPress theme with just a few lines in your CSS and HTML files. But before the magic can happen you need to first enqueue the Font Awesome stylesheet in your theme.
Enqueue from the remote Font Awesome server
To enable this function you need to add the following code to your WordPress theme’s functions.php file.
// Enqueues Font Awesome stylesheet
function enqueue_load_font_awesome() {
wp_enqueue_style( 'load-fa', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css' );
}
add_action( 'wp_enqueue_scripts', 'enqueue_load_font_awesome' );
Enqueue Font Awesome from your local server
Or you can directly link to a local copy of the Font Awesome stylesheet by adding the following code to your WordPress theme’s functions.php file:
// Enqueues Font Awesome from a locally stylesheet
function enqueue_font_awesome_stylesheet(){
wp_enqueue_style('font-awesome', get_stylesheet_directory_uri() . '/css/font-awesome.css');
}
add_action('wp_enqueue_scripts','enqueue_our_font_awesome_stylesheet');

Leave a Reply
Want to join the discussion?Feel free to contribute!