Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bobwol/9923cc5808e804412376d845da69ac16 to your computer and use it in GitHub Desktop.
Save bobwol/9923cc5808e804412376d845da69ac16 to your computer and use it in GitHub Desktop.

Revisions

  1. @DevinWalker DevinWalker revised this gist Nov 19, 2014. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion woocommerce-optimize-scripts.php
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@
    <?php
    /**
    * Optimize WooCommerce Scripts
    * Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
  2. @DevinWalker DevinWalker revised this gist Nov 24, 2013. 2 changed files with 39 additions and 58 deletions.
    58 changes: 0 additions & 58 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,58 +0,0 @@


    Discover Gists
    DevinWalker

    theme-tour.php
    Theme activation welcome message
    layerslider-conditional.php
    Load LayerSlider scripts/styles only when a shortcode is present in the content (can be modified to custom meta, etc).
    functions.php
    WooCommerce force SSL entire shop
    gravity-forms_bootstrap
    Gravity Forms Twitter Bootstrap CSS Styles Turn OFF Gravity Forms CSS Turn On HTML5 See: http://roots.io/style-gravity-forms-with-bootstrap/
    Your Gists


    language: PHP ACE Editor indent mode: Spaces indent size: 2

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    <?php
    /**
    * Optimize WooCommerce Scripts
    * Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
    */
    add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
    function child_manage_woocommerce_styles() {
    //remove generator meta tag
    remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
    //first check that woo exists to prevent fatal errors
    if ( function_exists( 'is_woocommerce' ) ) {
    //dequeue scripts and styles
    if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) {
    wp_dequeue_style( 'woocommerce_frontend_styles' );
    wp_dequeue_style( 'woocommerce_fancybox_styles' );
    wp_dequeue_style( 'woocommerce_chosen_styles' );
    wp_dequeue_style( 'woocommerce_prettyPhoto_css' );
    Add Another File
    Create Secret Gist Create Public Gist
    © 2013 GitHub Inc. All rights reserved.
    The GitHub Blog Support Contact
    39 changes: 39 additions & 0 deletions woocommerce-optimize-scripts.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    <?php
    /**
    * Optimize WooCommerce Scripts
    * Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
    */
    add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );

    function child_manage_woocommerce_styles() {
    //remove generator meta tag
    remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );

    //first check that woo exists to prevent fatal errors
    if ( function_exists( 'is_woocommerce' ) ) {
    //dequeue scripts and styles
    if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) {
    wp_dequeue_style( 'woocommerce_frontend_styles' );
    wp_dequeue_style( 'woocommerce_fancybox_styles' );
    wp_dequeue_style( 'woocommerce_chosen_styles' );
    wp_dequeue_style( 'woocommerce_prettyPhoto_css' );
    wp_dequeue_script( 'wc_price_slider' );
    wp_dequeue_script( 'wc-single-product' );
    wp_dequeue_script( 'wc-add-to-cart' );
    wp_dequeue_script( 'wc-cart-fragments' );
    wp_dequeue_script( 'wc-checkout' );
    wp_dequeue_script( 'wc-add-to-cart-variation' );
    wp_dequeue_script( 'wc-single-product' );
    wp_dequeue_script( 'wc-cart' );
    wp_dequeue_script( 'wc-chosen' );
    wp_dequeue_script( 'woocommerce' );
    wp_dequeue_script( 'prettyPhoto' );
    wp_dequeue_script( 'prettyPhoto-init' );
    wp_dequeue_script( 'jquery-blockui' );
    wp_dequeue_script( 'jquery-placeholder' );
    wp_dequeue_script( 'fancybox' );
    wp_dequeue_script( 'jqueryui' );
    }
    }

    }
  3. @DevinWalker DevinWalker created this gist Nov 24, 2013.
    58 changes: 58 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,58 @@


    Discover Gists
    DevinWalker

    theme-tour.php
    Theme activation welcome message
    layerslider-conditional.php
    Load LayerSlider scripts/styles only when a shortcode is present in the content (can be modified to custom meta, etc).
    functions.php
    WooCommerce force SSL entire shop
    gravity-forms_bootstrap
    Gravity Forms Twitter Bootstrap CSS Styles Turn OFF Gravity Forms CSS Turn On HTML5 See: http://roots.io/style-gravity-forms-with-bootstrap/
    Your Gists


    language: PHP ACE Editor indent mode: Spaces indent size: 2

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    <?php
    /**
    * Optimize WooCommerce Scripts
    * Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
    */
    add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
    function child_manage_woocommerce_styles() {
    //remove generator meta tag
    remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
    //first check that woo exists to prevent fatal errors
    if ( function_exists( 'is_woocommerce' ) ) {
    //dequeue scripts and styles
    if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) {
    wp_dequeue_style( 'woocommerce_frontend_styles' );
    wp_dequeue_style( 'woocommerce_fancybox_styles' );
    wp_dequeue_style( 'woocommerce_chosen_styles' );
    wp_dequeue_style( 'woocommerce_prettyPhoto_css' );
    Add Another File
    Create Secret Gist Create Public Gist
    © 2013 GitHub Inc. All rights reserved.
    The GitHub Blog Support Contact