Small menu button not working – not finding js?
-
The button is set in css to appear on screen widths less than 643px.
ladbrokechurch.org.uk/Clicking the button does not display the drop-down menu. I do not think that the error is in css:
– I have tried removing all my css code but the problem persists
– I have tried copying the ‘small menu’ code from the parent style.css into the child file @media sections concerned.It would seem that I have somehow broken the link to the twenty thirteen/js/functions.js file but I can’t see where.
Any help would be appreciated.
-
You’re correct, I don’t see the functions.js file being linked in. I assume that when you switch back to the parent Twenty Thirteen theme, the mobile menu button works OK. It might be something in your functions.php file. Did you create one for your child theme? In the parent theme, the
twentythirteen_scripts_styles()function is responsible for enqueuing that Javascript file.Thank you for your response, CrouchingBruin
Yes, I do have a simple functions.php file:
function cd_add_editor_styles() { add_editor_style( 'AllSaints-editor-style.css' ); } add_action( 'init', 'cd_add_editor_styles' ); function register_my_menu() { register_nav_menu('AllSaints-menu',__( 'All Saints Menu' )); } add_action( 'init', 'register_my_menu' );I have not made any changes to the Twenty thirteen files – all changes are in the Child theme
Kip
Ah – just had a look at the parent functions.php file.
It seems that the enqueuing javascript is loaded in the footer for the comments form. I have removed the code in the footer relating to the comments because they are not allowed on this site and I wanted to speed up the page loading.I tried copying that block of code (twentythirteen_scripts_styles) from the parent functions.php file to mine but got the error “cannot redeclare ..”
Is there a way to implement it without loading all the contacts form stuff?
Kip
Can you try enqueing it separately in your child theme’s functions.php like this:
function enqueue_my_scripts() { // Loads JavaScript file with functionality specific to Twenty Thirteen. wp_enqueue_script( 'twentythirteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20150330', true ); } add_action( 'wp_enqueue_scripts', 'enqueue_my_scripts' );Sadly that did not solve it.
I just reloaded your site and the mobile menu button seems to be working, now. I also see the functions.js file being included at the bottom of your page source. Maybe you need to clear your browser cache.
Ugh, now it’s not working. Maybe you switched to the parent theme briefly?
.. so I have reinstated
<?php wp_footer(); ?>and the menu now works.
If there is a better solution I’d be very glad to know about it.
Thanks for your help, CrouchingBruin.
Kip
The topic ‘Small menu button not working – not finding js?’ is closed to new replies.
