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 have a template that has been hardcoded in the header and it needs to be Enqueued. I don't know what to do and the template provider is giving me the run around. JQueries won't work because of it. I installed the Q&A plugin it won't work properly because of this script. If I delete the script. Q&A works but my menu appearance is gone:

<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/cookie.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/js.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/PIE.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/cusel-min-2.3.1.js"></script>
<script type="text/javascript">
var params = {
        changedEl: "#zip, #zip1, #zip2, #zip3, #zip4, #zip5, #zip6, #zip7, #zip8, #zip9, #zip10, #zip11",
        scrollArrows: true
    }

    cuSel(params);
     $(document).ready(function(){
    jQuery$('div.sel-data').last().css('margin-left','0');
     });
</script>


<!-- superfish menu -->
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/superfish.js"></script>
<script type="text/javascript">
 $(document).ready(function(){
            jQuery('ul.sf-menu').superfish({
                animation:   {opacity:'show', height:'show'},
                speed:       'fast',                          // faster animation speed 
                autoArrows:  false,                           // disable generation of arrow mark-up 
                dropShadows: false                            // disable drop shadows 
            });
 });
  </script>
    <!-- /superfish menu -->
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/cufon-yui.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/Bebas_Neue_400.font.js"></script>

This is what dalton wrote from Q&A.

Your theme is hard-coding a link to the jQuery library in the header. You will need to contact your theme developer and ask them to properly enqueue the scripts instead or your site will have problems with any jQuery based plugins.

I don't know what to do or where to start. Any help would be wonderful

My site is www.halseyschools.com

share|improve this question
    
js.js :) very original file name... Is this jQuery, because I don't see any reference to it? –  onetrickpony Jul 20 '11 at 21:16
add comment

1 Answer

Add your script to a file inside your Theme root, e.g. /js/my-script-name.js.

In functions.php, put add a function to enqueue your script:

function mytheme_enqueue_some_script() {
    if ( ! is_admin() ) {
        $scriptsrc = get_template_directory_uri() . '/js/my-script-name.js';
        wp_register_script( 'my-script-name', $scriptsrc );
        wp_enqueue_script( 'my-script-name' );
    }
}

Then, hook that function into the wp_enqueue_scripts hook:

add_action( 'wp_enqueue_scripts', 'mytheme_enqueue_some_script' );

If your script is dependent on any other scripts, we can add that information to the wp_register_script() call.

For further reading:

share|improve this answer
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.