enqueue jQuery Accordion scripts (3 posts)

  1. lberelson
    Posted 2 years ago #

    I have 3 jQuery accordion scripts that live in my content theme in /jquery-ui/js/

    jquery-ui-1.10.3.custom.js, jquery-1.9.1.js, ux.js

    They work when hardcoded in header. Having trouble enqueuing them.

    functions file

    function jqueryAccordion () {
       wp_register_script ('accordion', get_template_directory_uri() . '/jquery-ui/js/', array('jquery-ui-1.10.3.custom.js', 'jquery-1.9.1.js','ux.js') );
       wp_enqueue_script( 'accordion', get_template_directory_uri() . '/jquery-ui/js/', array('jquery-ui-1.10.3.custom.js', 'jquery-1.9.1.js','ux.js') );
    add_action('init', 'jqueryAccordion');
  2. esmi
    Forum Moderator
    Posted 2 years ago #

    Do not enqueue extra copies of jQuery. WordPress allready ships with jQuery 1.10.x

  3. lberelson
    Posted 2 years ago #

    ux.js has modest modification to the doc model. EIther way the syntax (or something else i'm doing is wrong) and not working. I know the scripts are fine b/c they work hardcoded. So it's how i'm implementing enqueue.
    I thought if i put it in a function file it would get called before the header and work which from what i saw on some posts was the problem. As is written scripts just arent' being called... am i supposed to implement this somewhere else... template itself just uses div accordion which works when hardcoded.

Topic Closed

This topic has been closed to new replies.

About this Topic