WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Enqueuing jquery.min.js (5 posts)

  1. DesignLoud
    Member
    Posted 1 year ago #

    Alright, I know this should be simple but I am obviously looking over something. I am hoping someone can chime in with some help. I am trying to enqueue the Google JQuery lib and I just cant get it right to save me.

    Here is what I have, I have tried to deregister the jquery script and every other form/variation but just cant get it. I'm sure this has been answered thousands of times. Please be patient :D Thanks

    function wilmper_load_js_lib() {
    
    wp_deregister_script('jquery');
    
    wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js', array('jquery'));
    
    wp_enqueue_script( 'jquery' );
    }
    add_action( 'wp_enqueue_scripts', 'wilmper_load_js_lib' );

    Please tell me where/what went wrong, thanks in advance!

  2. Andrew Bartel
    Member
    Posted 1 year ago #

    Why would you want to use 1.4.2 instead of the current version?

  3. DesignLoud
    Member
    Posted 1 year ago #

    Trust me I know, but I am modifying a theme for someone and thats what version the site resides on. It will save me alot of time if I can stick with that version until they upgrade

  4. DesignLoud
    Member
    Posted 1 year ago #

  5. microberto
    Member
    Posted 1 year ago #

    The above snippet should not be used for public sites. WordPress comes with its own jquery, just use it:

    wp_enqueue_script('jquery');

Topic Closed

This topic has been closed to new replies.

About this Topic