1

I have a theme that makes use of Font Awesome icons by default. I have replaced all of them with custom .png icons using CSS. However, on web page load, the font-awesome icons takes up a size or bandwidth of 55.8 kb which is not good for page speed. How do I prevent an http request for Font Awesome icons altogether? I tried renaming and deleting the Font Awesome folder of the theme but the http request is still being made although it's unclear if its still taking up the same aforementioned bandwidth but I would like to prevent the request anyway. I have the following lines in my functions.php:

function myTheme_load_style() {
    if ( !is_admin() ) {
        wp_enqueue_style( 'myTheme_googleFonts', '//fonts.googleapis.com/css?family=Lato:400,700,900,400italic,700italic|Merriweather:700,900,400italic' );
        wp_enqueue_style( 'myTheme_fontawesome', get_template_directory_uri() . '/fa/css/font-awesome.css' );
        wp_enqueue_style( 'myTheme_style', get_stylesheet_uri() );
    }
}

Would modifying the above lines help? If yes, how? If no, how do I, then?

3
  • Remove or comment out the second wp_enqueue_style line. Mar 22, 2016 at 14:06
  • @ialocin I use a child theme with its own functions.php. There are only a few lines of php that I added on my own. The rest are inherited from the parents. How do I remove what you asked me to remove, in the child theme, without altering the parent's files?
    – user90747
    Mar 22, 2016 at 14:09
  • 2
    As @Bruno said, use wp_dequeue_style(). Next time please add relevant information, like the use of a child theme to your question. Mar 22, 2016 at 14:14

1 Answer 1

2

You will need to find how your theme is calling the styles. If with enqueue, you can use the wp_dequeue_style() on your child theme, if directly in header/footer, you will need to copy those to your child theme and remove those calls.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy