Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using a carousel to display latest jposts on my front page and I am using the following code but it's not working.

function my_load_caroufredsel() {
        // Enqueue carouFredSel, note that we specify 'jquery' as a dependency, and we set 'true' for loading in the footer:
        wp_register_script( 'caroufredsel', get_template_directory_uri() . '/js/jquery.carouFredSel-6.1.0-packed.js', array( 'jquery' ), '6.1.0', true );
        // For either a plugin or a theme, you can then enqueue the script:
        wp_enqueue_script( 'my-caroufredsel', get_template_directory_uri() . '/js/my-caroufredsel.js', array( 'caroufredsel' ), '', true );
    }
    add_action( 'wp_enqueue_scripts', 'my_load_caroufredsel' );

Any one can please tell what's the problem with the above code. Thanks

share|improve this question
add comment

1 Answer 1

You only register your first script, but don't enqueue it. Change wp_register_script to wp_enqueue_script and it should work. Registering it is useful if you may possibly enqueue it at different times/conditions, but in this case you can just enqueue it straight away.

share|improve this answer
    
Thanks for your reply. I have done it previously and have done again after your reminder but it's not working. –  user1666698 Oct 20 '12 at 18:54
    
verify that your paths are all correct and the scripts exist where you're enqueueing them. –  Milo Oct 20 '12 at 19:07
    
Actually I have a folder with the name js in my theme directory and both the scripts are here. So I think paths are correct. –  user1666698 Oct 20 '12 at 19:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.