jQuery Mobile Enqueue - Loading in WordPress Admin -
i've enqueued scripts according documentation, jquery mobile still loading in admin. code 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 i'm doing wrong?
try way:
function mda_script_init() { wp_register_script( 'jquerypremobile', get_template_directory_uri() .'/library/js/jquery-pre-mobile.js', array( 'jquery' ), '1.0' ); wp_enqueue_script( 'jquerypremobile' ); // etc... } add_action('wp_enqueue_scripts', 'mda_script_init'); reference: http://codex.wordpress.org/function_reference/wp_enqueue_script
ps: wordpress specific questions better placed here: https://wordpress.stackexchange.com/
Comments
Post a Comment