Support » Plugin: Use Google Libraries » [Plugin: Use Google Libraries] How do I load a JS library with this plugin? [noob question]

  • Resolved makimaki

    (@makimaki)


    I am just getting back to JQuery and wordpress. Been trying to load JQuery UI to my WordPress site but can’t seem to.

    I know they need to be in the head tag and all… just not know how to do it with this plugin.

    With wordpress, I add some code on functions.php template to enqueue it. This is what I have on my template

    function myjquery() {
    if (!is_admin()) {
    wp_enqueue_script(‘jquery’);
    wp_enqueue_script(‘jquery-ui’);

    // load a JS file from my theme: js/theme.js
    wp_enqueue_script(‘my_script’, get_bloginfo(‘template_url’) . ‘/magick.js’);

    }
    }
    add_action(‘init’, ‘myjquery’);

    This is all the scripts I am loading but don’t see jquery-ui on the website’s frontend. I see the main jquery file though and even my custom JS file.

    Am I even close or is this not how you do it with this plugin. please help… preferably with the exact code. but any hint would help

    http://wordpress.org/extend/plugins/use-google-libraries/

Viewing 1 replies (of 1 total)
  • Plugin Author Jason Penney

    (@jczorkmid)

    Loading scripts as you’ve outlined here should behave exactly the same with or without this plugin loaded (with the exception of where it’s loading the scripts from).

    If your script uses jquery-ui then all you should let the script loader handle the dependencies rather than enqueueing them by hand. Something like this:

    wp_enqueue_script('my_script',
                       get_bloginfo('template_url') . '/magick.js',
                       array('jquery-ui'));
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Use Google Libraries] How do I load a JS library with this plugin? [noob question]’ is closed to new replies.