I am developing a WordPress theme and as part of my header wish to include some Font Awesome icons (see below):
<div class="header-socials">
<div class="social-item">
<a href="#"><i class="fab fa-instagram"></i></a>
</div>
<div class="social-item">
<a href="#"><i class="fab fa-facebook-f"></i></a>
</div>
<div class="social-item">
<a href="#"><i class="fab fa-linkedin-in"></i></a>
</div>
</div>
I have tried using the Font Awesome plugin (as recommended by font awesome) as well as "manually adding font awesome to wordpress" following the guidance set out here (which includes modifying functions.php). I have also tried doing the old classic of wp_enqueue_scripts, but this doesn't seem to work either! Currently I have in my functions.php:
if (! function_exists('fa_custom_setup_kit') ) {
function fa_custom_setup_kit($kit_url = '') {
foreach ( [ 'wp_enqueue_scripts', 'admin_enqueue_scripts', 'login_enqueue_scripts' ] as $action ) {
add_action(
$action,
function () use ( $kit_url ) {
wp_enqueue_script( 'font-awesome-kit', $kit_url, [], null );
}
);
}
}
}
fa_custom_setup_kit('https://kit.fontawesome.com/my_kit_code.js');
(with my_kit_code replaced with my actual kit code).This indeed results in the loading of font awesome at least that what Chrome dev tools are showing, this line is currently loaded inside my head tag:
<script type="text/javascript" src="https://kit.fontawesome.com/my_kit_code.js"></script>
Could anyone suggest as to what I am overlooking/doing wrong etc? Thanks in advance.