Skip to main content
2 of 4
posted various solutions suggested in answers to show what I tried
dadra
  • 33
  • 2
  • 3
  • 10

How to use jquery included with wordpress for jpanelmenu

When using jpanelmenu in my wordpress themes I've been loading jquery from the google api, like this:

if ( !is_admin() ) {

    // jQuery
    wp_deregister_script('jquery');
    wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"), false);
    wp_enqueue_script('jquery');

    // load jPanelMenu
    wp_enqueue_script('jpanelmenu', get_bloginfo('template_directory') . "/js/jquery.jpanelmenu.js");

}

But I'd rather use the version of jquery that comes included with wordpress. Can anyone advise me on how to do that, or tell me if I'm wrong in thinking that using wp's built-in jquery would be better than what I'm doing in the code above?

Thanks in advance!

edited

Based on the answers below I tried the following, but jpanelmenu would not function:

function wpa_132328_enqueue_scripts(){
if ( !is_admin() ) {

        // jQuery
        wp_enqueue_script('jquery');

        // load jPanelMenu
        wp_enqueue_script('jpanelmenu', get_bloginfo('template_directory') . "/js/jquery.jpanelmenu.js");

    }
}
add_action( 'wp_enqueue_scripts', 'wpa_132328_enqueue_scripts' );

and

if ( !is_admin() ) {

    // jQuery
    wp_enqueue_script('jquery');

    // load jPanelMenu
    wp_enqueue_script('jpanelmenu', get_bloginfo('template_directory') . "/js/jquery.jpanelmenu.js");

}

and

wp_enqueue_script('jpanelmenu', get_bloginfo('template_directory') . "/js/jquery.jpanelmenu.js", array('jquery') );

and

if ( !is_admin() ) {

    wp_enqueue_script('jpanelmenu', get_bloginfo('template_directory') . "/js/jquery.jpanelmenu.js", array('jquery') ); 

}
dadra
  • 33
  • 2
  • 3
  • 10