Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1475878

    Hi,

    I need to add customization to the mobile hamburger menu/nav bar. The code I need to customize is in enfold/js/avia-snippet-hamburger-menu.js in function avia_hamburger_menu(). I tried making a copy of this file in my child theme, enfold-child, and making the modifications there, but that did not work. So, for now I just made the modifications in enfold/js/avia-snippet-hamburger-menu.js. This works but obviously is not ideal when theme updates happen. Is there a way to make this modification in a file that won’t be updated in the main enfold theme? I am using enfold 6.0.8.

    Thanks,
    Jed

    #1475882

    what you try to influence on the hamburger script file?

    you can deregister the parent script and register child-theme edited files then.
    My recommendation is to have the same tree structure as the parent – create a js subfolder in your child-theme directory.

    if you use the option of enfold to use minified files – you had to upload both files – in your case:
    avia-snippet-hamburger-menu.js and avia-snippet-hamburger-menu.min.js

    to get the minified version you can use this : https://codebeautify.org/minify-js

    put this in your child-theme functions.php :

    function wp_change_hamburger_script() {
      $vn = avia_get_theme_version();
      $child_theme_url = get_stylesheet_directory_uri();
      $min_js = avia_minify_extension( 'js' );
    
      wp_deregister_script( 'avia-hamburger-menu' );
      wp_enqueue_script('avia-hamburger-menu-child', "{$child_theme_url}/js/avia-snippet-hamburger-menu{$min_js}.js", array('avia-default'), $vn, true);
    }
    add_action( 'wp_enqueue_scripts', 'wp_change_hamburger_script', 100 );
    #1475896

    Hi,

    Thank you for the info @Guenni007.

    Best regards,
    Ismael

    #1475914

    @Ismael : can you erase from GitHub Library on “Online Resources from Third Party Developers” the
    “Disable loading of Google fonts and host them on your on server by Guenni007Disable loading of Google fonts and host them on your on server by Guenni007”
    it is a bit deprecated since Enfold Font Manager is established.

    #1475954

    Hi,


    @Guenni007
    : Could you provide a direct link to the folder? I can’t find it in the KriesiMedia/enfold-library.

    Best regards,
    Ismael

    #1475978

    https://github.com/KriesiMedia/enfold-library

    on the bottom of that page there is a link under “Online Resources from Third Party Developers”

    #1475995

    Hi,


    @Guenni007
    : We deleted the entry from the description.

    Best regards,
    Ismael

    #1476651

    Why does the duplication of the avia-snippet-hamburger-menu.js in the child script not work out of the box like it does for many other files, causing the need to deregister the parent version and register the child version explicitly?

    Thanks!

    #1476697

    Hi,
    By the order that it is loaded, glad Guenni007 could help, thank you Guenni007.

    Best regards,
    Mike

    #1476841

    I don’t understand that reply. The order that it is loaded does not explain why some files can be duplicated in the child theme without additional coding and other cannot.

    #1476853

    Hi,
    The avia-snippet-hamburger-menu.js is loaded before the child theme, so you need to deregister the parent version and register the child version explicitly.

    Best regards,
    Mike

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