Menu not working on Mobile Site
-
Hi, I’m using the 2012 theme, everything is working on PC, but the mobile site menu button is not working. The only changes I made to the theme are a custom header, the site is:
-
Doesn’t look like the “navigation.js” located in the 2012 theme/js/ is getting loaded. That’s what gets your h3 menu button to work on responsive mobile.
Is there a way I can fix this?
I got around it by installing the WordPress Mobile Plugin and creating a menu, but if there is a way to fix it in the code, I’d love to know.
Try deactivating all plugins to explore whether any could be responsible.
I tried that, none of them were. I did edit the header.php to add a custom header to my site, could that have affected it? It’s the only thing I can think of.
That is likely as the original theme does not experience this issue.
Can you set up a Child Theme and transfer your customsations to that? As you’ve made the modifications directly to the Twenty Twelve theme we can’t simply switch to the original theme and explore this.
To your original problem of not getting the navigation.js included, you need to first make sure it’s in your theme’s folder. Probably in your “js” folder in your theme. If it’s not, you can just grab it from the 2012 theme. Then open up your functions.php file in your theme.
In the 2012 theme, the js gets added on line 103:
/* * Adds JavaScript for handling the navigation menu hide-and-show behavior. */ wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '1.0', true );Make sure that is in there.
I had this issue too. I had a child header file where I had simply moved the navigation from above to below the banner image but the mobile menu was not working.
I tried the plugin reset but it didnt work. I copied the header file from the main 2012 them to the child theme, made the edit again and it worked ok. This fixed the two sites I have using 2012.
I have not examined the code but must be a difference somewhere between 2012 them v1.4 and 1.5 or possibly 3.9 and 4.0 of WP as I did not notice the issue until recently.
@andy60103 I can guarantee your issue is not related to this almost-year-old- topic. If you need support please create a new htread: https://wordpress.org/support/forum/how-to-and-troubleshooting#postform
And I know the answer to your problem.
The topic ‘Menu not working on Mobile Site’ is closed to new replies.