• I have this in my head:

    add_action('wp_head', 'add_scripts');
    wp_head();

    and in functions I have this

    function add_scripts() {
    	wp_register_script('superfish', get_bloginfo('template_directory').'/js/superfish.js', array('jquery'));
    	wp_register_script('slideshow', get_bloginfo('template_directory').'/js/jquery.cycle.lite.min.js', array('jquery'));
       wp_enqueue_script('my_scripts', get_bloginfo('template_directory').'/js/js.js', array('jquery', 'superfish', 'slideshow'));
    }

    But my scripts won’t print? please help

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter lerizzle

    (@lerizzle)

    Thanks Esmi. I see you posted the same on someone elses question but I had read that too (i do look at docs before posting ;). After some digging I found that it’s an issue with putting the script with the init_head action as oppose to init. Is that correct?

    This will work…

    function add_scripts() {
    if( !is_admin(){
    wp_register_script('superfish', get_bloginfo('template_directory').'/js/superfish.js', array('jquery'));
    wp_register_script('slideshow', get_bloginfo('template_directory').'/js/jquery.cycle.lite.min.js', array('jquery'));
    wp_enqueue_script('my_scripts', get_bloginfo('template_directory').'/js/js.js', array('jquery', 'superfish', 'slideshow'));
    }
    }
    add_action('init', 'add_scripts');

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘enqueue script issue’ is closed to new replies.