Hi Lucy,
Your styles and scripts should be loading from the same parent directory, but for some reason they are not: style.css
is being loaded from wp-content/themes/twentyeleven-child/style.css
, and menu.js
is being loaded from wp-content/themes/twentyeleven/menu.js
.
That is probably the reason for the discrepancies you seem to be experiencing between your live and local tests.
Since you are developing a child theme, you should put your JS folder inside the twentyeleven-child
folder. In that case, and assuming your menu.js
is located inside wp-content/themes/twentyeleven-child/js/
, this slightly different call should force WP to look for the menu.js
file in the child theme folder instead of the original Twenty Eleven one:
<script src="<?php echo get_bloginfo('stylesheet_directory');?>/js/menu.js" type="text/javascript"></script>
As for my profile, I’m not a moderator: just a regular user who likes to help out on the forums whenever I have time, ??
Let me know if you have any other questions.
Cheers!
Edit: Oh, I almost forgot. You seem to be calling jQuery twice on your test site, and different versions as well:
– On line 15, v.1.4.2 from the Google Ajax API engine:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
– On line 34, v.1.6.1. from WP includes folder:
<script type='text/javascript' src='https://www.lucyryderwebprint.co.uk/test/wp-includes/js/jquery/jquery.js?ver=1.6.1'></script>
You should only keep one of these. My advise would be to always use the most recent version of jQuery. If you want to load it from Google because of speed, you should first unregister WP’s version and register Google’s. You can do that from your functions.php file with the following code:
function user_custom_jquery() {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js'), false, false, true;
wp_enqueue_script( 'jquery' );
}
add_action('wp_enqueue_scripts', 'user_custom_jquery');
The true
part is the value for the in_footer
parameter. Change it to false
to load it from your header instead of your footer.