Viewing 1 post (of 1 total)
  • Author
    Posts
  • #477979

    Hello to all,
    I would like to share one quick tip how to little bit speed up loading jQuery. It is better and faster to load jQuery from google instead of own hosting.
    Just add following code into functions.php below line with <?php

    //Making jQuery Google API
    function modify_jquery() {
    if (!is_admin()) {
    // comment out the next two lines to load the local copy of jQuery
    wp_deregister_script('jquery');
    wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js', false, '1.11.2');
    wp_enqueue_script('jquery');
    }
    }
    add_action('init', 'modify_jquery');

    And don’t forget to use correct version of jQuery, currently it is 1.11.2

Viewing 1 post (of 1 total)
  • The topic ‘Tip: jQuery from public library’ is closed to new replies.