Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1098442

    LiamHindson
    Participant

    Hi,

    Is it possible to dequeue the scripts for Google Fonts and Renew? I want to combine the CSS from these scripts into one file to improve my Google PageSpeed and loading time.

    I have sorted out all of the other CSS scripts except for the following:
    https://www.teachtutti.com/wp-content/themes/x/framework/css/dist/site/stacks/renew.css
    https://fonts.googleapis.com/css?family=Lato:300,300italic,700,700italic,900,400%7CPacifico:400&subset=latin,latin-ext,latin,latin-ext

    I’ve now combined these CSS scripts into the main theme styling file (Appearance – Customise – Custom – Edit Global CSS). However, I can’t stop this callout from happening.

    My domain is teachtutti.com.

    Thanks,

    Liam

    #1098553

    Paul R
    Moderator

    Hi Liam,

    You can try adding this code in your child theme’s functions.php file.

    
     add_action( 'wp_enqueue_scripts', 'remove_default_stylesheet', 20 );
    
    function remove_default_stylesheet() {
         $google_fonts_request = x_cache_google_fonts_request();
         
      if ( $google_fonts_request != '' ) {
        wp_dequeue_style( 'x-google-fonts', $google_fonts_request, NULL, X_VERSION, 'all' );
      }
         
         wp_deregister_style( 'x-stack', X_TEMPLATE_URL . '/framework/css/dist/site/stacks/renew.css', NULL, X_VERSION, 'all' );
    
    }
    

    Hope that helps

    #1098760

    LiamHindson
    Participant

    Hi Paul,

    Thanks for your reply. I’m afraid I’ve tried this and it hasn’t seemed to work.

    Updated functions.php file: http://www.teachtutti.com/wp-content/uploads/2016/07/Updated-functions.jpg

    Latest Page Speed report: http://www.teachtutti.com/wp-content/uploads/2016/07/Page-Speed.jpg

    I gave it a while before checking again with Page Speed so I’m confident that they were reviewing the latest cache.

    Best wishes,

    Liam

    #1098931

    Rahul
    Moderator

    That’s great!

    If you have any further queries, do let us know. We’d be happy to assist you with everything!

    Thanks.

    #1099078

    LiamHindson
    Participant

    Hi Rahul,

    Sorry, I said that this didn’t have an effect on the scripts being displayed. They aren’t being dequeued and are still showing up as normal.

    Best,

    Liam

    #1099473

    Rue Nel
    Moderator

    Hey Liam,

    Are you using CloudFlare or may have installed a caching plugin like WordFence, W3 Total Cache or WP Super Cache? Please keep in mind that after doing every updates or theme changes, always remember to clear all caches when updating so that the code from the latest release is always in use. This will help you to avoid any potential errors.

    Please let us know how it goes.

    #1099764

    LiamHindson
    Participant

    Hi Rue,

    Thanks very much for this, I completely forgot to clear the cache. It works perfectly!

    Cheers 🙂

    Liam

    #1099766

    Thai
    Moderator

    Glad it worked 🙂

    If you need anything else please let us know.