Hi,
I’ve done a lot or reading to ensure that I am including my JQuery and custom javascript for my custom theme without blowing up other plugins…
The site that I am turning into a wp-theme requires this javascript:
<script src="http://www.google.com/jsapi?key=ABQIAAAABZGjjDpjmjbzLaNWBpdrWhRYfwzT-VuwidSQZM_JU-MUSrbEShR1efDdxuqpWPsjsfs1V_59FUTrxg" type="text/javascript">
</script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js">
</script> <script type="text/javascript" src="./scripts/cycle/jquery.cycle.all.min.js"></script>
<script type="text/javascript" src="./scripts/cycle/aaro_cycle.js"></script>
<script type="text/javascript" src="./scripts/cycle/aaro_contest_cycle.js"></script>
<script type="text/javascript" src="./scripts/jquery.hoverIntent.minified.js"></script>
<script type="text/javascript" charset="utf-8" src="./scripts/mega_menu.js"></script>
I started off pretty simple I just wanted to see if I could load the version of jQuery I need plus on jQuery plugin and one custom javascript so after researching it seemed this was the best way?:
<?php
function loadCustomScripts(){
wp_deregister_script('jquery');
wp_register_script('jquery', ("http".($_SERVER['SERVER_PORT'] == 443 ? "s" : "")."://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"), false, '1.4.3');
wp_enqueue_script('jquery');
wp_deregister_script('jquery.cycle.all.min');
wp_register_script('jquery.cycle.all.min', ("./scripts/cycle/jquery.cycle.all.min.js"));
wp_enqueue_script('jquery.cycle.all.min');
wp_deregister_script('mega_menu');
wp_register_script('mega_menu', (get_bloginfo("stylesheet_directory") . "/scripts/mega_menu.js"));
wp_enqueue_script('mega_menu');
}
add_action('wp_enqueue_scripts','loadCustomScripts');
}
?>
I know that a normal <script> in the <head> section loads as my google api key loads. I do not want to load the other scripts this way as it most certainly will later cause conflicts.
I also put the scripts that I need inside the wp-includes/js folder but they did not include.
Can you help me get these loaded in the best way to avoid conflicts?
Regards,
Steve