WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I understand that in order to use a JavaScript library in WordPress, such as jQuery, we have to use the following code to prevent conflicts:

function my_scripts_method() {
    wp_enqueue_script( 'jquery' );

add_action('wp_enqueue_scripts', 'my_scripts_method' ); 

But how do I go about using a library that is not in the list of defined WordPress libraries. I am in particular interested in using the library at pikachoose.com which depends on jQuery, and must be intialized after jQuery. How do I go about that?

share|improve this question
The codex is your friend: codex.wordpress.org/Function_Reference/… – vancoder Aug 6 '13 at 21:34
Thanks a lot. I missed that. +10 if I could. – Greeso Aug 6 '13 at 21:38

This is how you should do this:

function my_scripts_method() {
        'pikachoose',  // this is your custom name for this JS lib
        get_stylesheet_directory_uri() . '/js/pikachoose/jquery.pikachoose.min.js',  // this is the url address of it's file (let's say you put it in your theme directory under /js/pikachoose/ directory
        array( 'jquery' )  // it depends on jquery
add_action( 'wp_enqueue_scripts', 'my_scripts_method' );

You can find full reference of wp_enqueue_script here: http://codex.wordpress.org/Function_Reference/wp_enqueue_script

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.