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
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:Then, hook that function into the
wp_enqueue_scripts
hook:If your script is dependent on any other scripts, we can add that information to the
wp_register_script()
call.For further reading:
wp_register_script()
wp_enqueue_script()