• Resolved christhesoul

    (@christhesoul)


    How do I include the jquery UI core with wp_enqueue_script?

    My code is as follows, but it only seems to pull in the normal jquery library, and not the UI.

    <?php wp_enqueue_script('jquery'); ?>
    <?php wp_enqueue_script('jquery-ui-core'); ?>

    I also tried:

    <?php wp_enqueue_script('jquery,jquery-ui-core'); ?>

    But that didn’t work either. Any ideas?

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter christhesoul

    (@christhesoul)

    Ah, it makes sense now.

    If anybody stumbles across this, here’s how I understand this thing works:

    If you’re importing JS libraries (such as jQuery or Mootools) then it stands to reason that you’ll write a custom .js file.

    wp_enqueue_script asks you for a name of that file, the path to it, and the libraries on which your script depends.

    Multiple libraries are popped into an array.

    So I’ve ended up with something like this:

    wp_enqueue_script('foo',get_bloginfo('template_directory') . '/js/foo.js',array('jquery','jquery-ui-core','jquery-ui-draggable','jquery-ui-droppable'));

    I hope this helps somebody else.

    And thanks to racer x.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Including jquery UI with wp_enqueue_script’ is closed to new replies.