Remove MAXCDN link/load font awesome locally

About this forum
These forums have not been active for several years. They're available for search and reference, but a lot of this information is likely out of date.

For current information, try visiting our Knowledge Base.

Home / Support / Beaver Builder Theme / Remove MAXCDN link/load font awesome locally

This topic is: resolved
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #115076

    Samuel
    Participant

    Hi there BB Team –

    I understand that font awesome can load locally, however I’m unable to remove the <link id=”font-awesome-css” href=”https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css” rel=”stylesheet” type=”text/css” media=”all”> via functions.php in my child theme without removing FA entirely.
    For performance reasons, I want to load FA locally rather than across the CDN.

    I’ve searched here and online and haven’t been able to find an exact answer.
    Site: https://generic.ruzamdigital.com/

    KR,

    Sam

    #115262

    Jun
    Keymaster

    Hey Samuel!

    You should be able to dequeue the CDN font-awesome by using the code below. Give it a shot and let us know how it goes.

    function remove_unwanted_css(){
    	wp_dequeue_style('font-awesome');
    }
    add_filter('wp_print_styles', 'remove_unwanted_css');

    Jun

    #115707

    Samuel
    Participant

    Thanks Jun.
    I ended up doing it like this, after downloading the latest FA to a new folder called fonts:

    function add_font_awesome2()
    {
    wp_enqueue_style( ‘style’, get_stylesheet_uri() );
    wp_enqueue_style( ‘font-awesome2’, ‘/wp-content/fonts/css/font-awesome.min.css’ );
    }
    add_action( ‘wp_enqueue_scripts’, ‘add_font_awesome2’ );

    function remove_unwanted_css(){
    wp_dequeue_style(‘font-awesome’, ‘https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css’);
    }
    add_filter(‘wp_print_styles’, ‘remove_unwanted_css’);

    End result: halved my average page loading time

Viewing 3 posts - 1 through 3 (of 3 total)

The forum ‘Beaver Builder Theme’ is closed to new topics and replies.