0

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

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.

  • 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
0

Please make sure you are utilizing wp_head() and wp_footer() functions at appropriate places in your theme?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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