I can’t seem to install Font Awesome locally

enter image description here

I tried searching but I can’t seem to find a similar question so I am hoping that as an amateur, I am just making a big simple mistake.

What I want

I want to install Font Awesome to my WordPress theme and I want to do it locally.

Folder structure

This image is my folder structure:

What I tried

  • I downloaded Font Aweesome 5.0.9 from the official website and followed their instructions. I placed the fontawesome-all.js file in /static/fontawesome and included this line of code in my header.php.

    <script defer src="/static/fontawesome/fontawesome-all.js"></script>
    
  • I looked at a blog online and read another method. I took fontawesome.min.css and placed it in the CSS folder with the following line of code added to the header:

    <link rel="stylesheet" href="css/fontawesome.min.css">
    
  • I then tried to create an action with the following code and it didn’t work either.

    function add_font_awesome()
    {
    wp_enqueue_style( 'style', get_stylesheet_uri() );
    wp_enqueue_style( 'fontawesome', 
    get_template_directory_uri().'TestTheme/css/fontawesome.min.css' );
    }
    add_action( 'wp_enqueue_scripts', 'add_font_awesome' );
    
  • Additional notes

    For testing I shoved the following code in my main body and header but nothing ever appears.

    <i class="fab fa-wordpress"></i>
    

    I am unsure why this is not working, I believe I am probably making some crucial beginners mistake here but after reading multiple blogs and trying many different methods I have decided to try and ask for help.

    Read more here:: I can’t seem to install Font Awesome locally

    Leave a Reply

    Your email address will not be published. Required fields are marked *