I’ve enqueued the scripts properly according to documentation, but jquery mobile still loading in admin. My code is the following:
function mda_script_init() {
if (!is_admin()) {
wp_register_script( 'jquerypremobile', get_template_directory_uri() .'/library/js/jquery-pre-mobile.js', array( 'jquery' ), '1.0' );
wp_enqueue_script( 'jquerypremobile' );
wp_register_script( 'jquerymobile', 'http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js', array( 'jquery' ), '1.1.0' );
wp_enqueue_script( 'jquerymobile' );
wp_register_script( 'jqueryeffects', get_template_directory_uri() .'/library/js/jquery-effects.js', array( 'jquery' ), '1.0' );
wp_enqueue_script( 'jqueryeffects' );
wp_register_script( 'nwmatcher', 'http://s3.amazonaws.com/nwapi/nwmatcher/nwmatcher-1.2.5-min.js', false, '1.2.5' );
wp_enqueue_script( 'nwmatcher' );
wp_register_script( 'superfish', get_template_directory_uri() .'/library/superfish/supersubs.js', array( 'jquery' ), '1.4.8' );
wp_enqueue_script( 'superfish' );
wp_register_script( 'supersubs', get_template_directory_uri() .'/library/superfish/supersubs.js', array( 'jquery' ), '1.4.8' );
wp_enqueue_script( 'supersubs' );
}
}
add_action('init', 'mda_script_init');
Anyone know what’s going on? Or what I’m doing wrong?
Try this way:
Reference: http://codex.wordpress.org/Function_Reference/wp_enqueue_script
PS: WordPress specific questions are better placed here: https://wordpress.stackexchange.com/