Okay
  Public Ticket #514899
font awesome library update
Closed

Comments

  • Marcel started the conversation

    Hi !

    Is there any way I can update the Font Awesome library? I noticed that my Salient version (6.0.1) is using Font Awesome 4.2.4.

    I can go ahead and download the latest Font Awesome css file from here (http://fortawesome.github.io/Font-Awesome/get-started/) but how can I integrate it into the Salient Theme?
    Replacing the file will trigger an error and, after inspecting the code, I noticed that the theme loads the Font Awesome css library by requesting version 4.2.4 (like this: http://my_website/wp-content/themes/salient/css/font-awesome.min.css?ver=4.2.4). How can I tell the system to load version 4.4.0?


    Thanks,
    Marcel

  •  8,994
    Tahir replied

    Hey,

    Try opening your functions.php file and changing these items:

    wp_enqueue_style(\'font-awesome\');
    wp_register_style(\'font-awesome\', get_template_directory_uri() . \'/css/font-awesome.min.css\');

    wp_enqueue_style(\'font-awesome-2\');
    wp_register_style(\'font-awesome-2\', get_template_directory_uri() . \'/css/font-awesome_custom.min.css\');



    Cheers


    ThemeNectar Support Team 

  •  3
    cmstew replied

    Unfortunately the latest version of Font Awesome is still not implemented in the Salient theme. The way Tahir suggested is not really the best way of getting the job done.

     It took me a long time to figure this out, but the best way upgrade font-awesome to the latest version is to dequeue and deregister the Salient font awesome css and then load the font awesome css and shim file directly from font-awesome using a child theme and by editing the functions.php file.

    So add the below code to your functions.php file and clear any caches.This is for the current latest version of Font Awesome, but you can replace the links with newer ones when they release updates in the future.

    add_action( 'wp_enqueue_scripts', 'update_font_awesome');
    add_action( 'admin_enqueue_scripts', 'update_font_awesome');
    function update_font_awesome() {
        wp_dequeue_style( 'font-awesome' );
        wp_deregister_style( 'font-awesome' );
        wp_enqueue_style( 'font-awesome', 'https://use.fontawesome.com/releases/v5.9.0/css/all.css', '', '5.9.0' );
        wp_enqueue_style( 'font-awesome-shim', 'https://use.fontawesome.com/releases/v5.9.0/css/v4-shims.css', array('font-awesome'), '5.9.0');
    }