• Hi! I’ve searched the forums for countless of hours and this one eludes me.

    When I login to my admin area my jquery-ui script works as supposed.
    When I logout from the admin area my jquery-ui script doesn’t work at all. WEIRD.

    This is how I’m loading it in my theme’s functions.php file.

    // Loads the latest jQuery version [the best way to do it - is like this]
    function my_jquery() {
    
    if (!is_admin()) {
    
    // Loads jQuery
    wp_enqueue_script('jquery');
    // Loads jQuery ui
    wp_enqueue_script('jquery-ui');
    wp_enqueue_script('jquery-effects-core');
    }
    }
    add_action('wp_enqueue_scripts', 'my_jquery'); 
    
    // Loads jQuery dependent scripts
    if ( !is_admin() ) {//disables any when logged in to admin-area
    wp_register_script('navmenu', get_bloginfo('template_url').'/scripts/navmenu.js', array('jquery'), '', true);
    }
    
    //Run script
    function run_script() {//creates function run_scripts
    if (!is_admin()) {
    //wp_enqueue_script('faq');
    wp_enqueue_script('navmenu');
    }
    }
    //Loads function run_script into wp_header
    add_action('wp_enqueue_scripts', 'run_script');
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘jquery-ui’ is closed to new replies.