Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #1326553


    i am unable to override a template file from the main theme folder.

    The code works in parent folder but it doesnt work when i use the same exact file in the child theme folder.

    the file in question is avia-snippet-hamburger-menu.js

    I also found a script that is suppose to deregister the parent file and enqueue the child override..which works buttttttttttttt when i do that…the hamburger menu doesnt close anymore once you open it.

    let me know if you need anymore information


    Hey Jason,

    Thank you for the inquiry.

    What did you add or modify in the script file? Please provide the site URL and the login details in the private field so that we can check the issue.

    Best regards,


    So i created a staging environment to show you the difference. I am going to supply the working example which is our live site and the staging site which has it broken. I will denote what is live and what is staging on the private section. The modifications is on line 52 of avia-snippet-hamburger-menu.js and it starts with /**** call second menu *****/ and it ends on line 63. I pasted the code also in the private section.

    to briefly explain what is what.

    the live site:
    i have the modification on the parent file because that is the only way this works. to see what the modification does click on the on hamburger menu and it will be the second menu in the navigation.

    on the staging site. I have the modified js file in the child theme folder. As you will notice it doesnt work. but if you go to the functions.php i have a function commented out (//Load child theme avia.js) if you remove the comment, the modification does work, but when you go to try to close the hamburger doesnt retract up. the function starts line 30 and ends on line 37



    Thank you for the update.

    There is an invalid code in the wp_change_aviajs function. You do not have to define the path of the script when using the wp_dequeue_script and wp_deregister_script functions. All you need is the script handle, which is “avia-hamburger-menu” in this case.

    This is the updated script.

    // Load child theme avia.js
    function wp_change_aviajs() {
    	wp_dequeue_script('avia-hamburger-menu' );
    	wp_deregister_script( 'avia-hamburger-menu');
    	wp_enqueue_script('avia-hamburger-menu', get_stylesheet_directory_uri().'/avia-snippet-hamburger-menu.js', array('jquery'));
    add_action( 'wp_enqueue_scripts', 'wp_change_avia_js', 100 );

    Best regards,


    i saw that you made the modification to functions, but it doesn’t work. My modification doesn’t appear in the menu like how it does in the live version of the site. It works only if i apply the modification to the parent file but not child file


    never mind i figured it out… you added an extra underscore to add_acction. it works!!! thank you :D



    Great, I’m glad that you got it working, and thanks for the update. Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.