Before you install font awesome, consider using dashicons which are already included in WordPress so you only need to load them.
Otherwise, add the following PHP code to your child themes functions file to load font awesome icons.
add_action( 'wp_enqueue_scripts', 'add_font_awesome_icons' );
function add_font_awesome_icons() {
wp_enqueue_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css' );
}
The fonts are hosted here
You can also load the icons from cloudfare.com:
add_action( 'wp_enqueue_scripts', 'add_font_awesome_cloudfare' );
function add_font_awesome_cloudfare() {
wp_enqueue_style( 'font-awesome', '//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css' );
}
You can also download the font icons and upload the folder to your child themes root directory, them load them using PHP code in your functions file like this:
add_action( 'wp_enqueue_scripts', 'add_font_awesome_child_theme' );
function add_font_awesome_child_theme() {
wp_enqueue_style( 'font-awesome', get_bloginfo( 'stylesheet_directory' ) . '/font-awesome/css/font-awesome.min.css' );
}
Make sure the path to the font-awesome.min.css file is correct.
Then use them in your theme like this
Leave a Reply