I have successfully been using jpanelmenu in my wordpress themes for some time, 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"); }
I'd rather use the version of jquery that comes included with wordpress, but can't figure out how to make that happen. 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?
I am instantiating jpanelmenu like this:
$(document).ready(function () { var jPM = $.jPanelMenu({ duration: 100, openPosition: "240px", direction: "left", keyboardShortcuts: false }); jPM.on(); // turn on jPanelMenu });
Thanks in advance!
edited
Based on the answers below I tried the following, but jpanelmenu would not function (clicking on the menu trigger does not reveal the off-canvas menu):
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') ); }