[Resolved] Support for Walker_Nav_Menu

Home Forums Support [Resolved] Support for Walker_Nav_Menu

Home Forums Support Support for Walker_Nav_Menu

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #22689
    Krzysztof

    Hello πŸ™‚ Could You add to all wp_nav_menu a walker? I need this to do something really cool but I don’t want to change GeneratePress PHP files in each new version.

    #22732
    Tom
    Lead Developer
    Lead Developer

    I can’t add a walker to the nav by default – but when this new version is released remind me to give you a chunk of code that will replace the current menu with a menu that accepts a walker.

    I should be submitting the newest version tonight.

    Thanks!

    #28434
    Tom
    Lead Developer
    Lead Developer

    Do you still need the code to do this?

    Let me know πŸ™‚

    #28437
    Krzysztof

    Yes, I still need a walker – I must separate arrow that inform of existing submenu and show submenu only when cursor is above arrow πŸ™‚

    #28964
    Tom
    Lead Developer
    Lead Developer

    Ok, give this a go: https://gist.github.com/generatepress/47e6abb67b41883e1910

    You should only end up with one add_action and one remove_action, which you should match with the navigation position setting you have set in the Customizer.

    You can change the name of the Walker to whatever you name your walker.

    Hope this helps πŸ™‚

    #28986
    Krzysztof

    Hmm I need to change something in GeneratePress files? Because now it doesn’t work and I have two navigation menu.

    #28987
    Krzysztof

    remove_action return false even when I changed it to:

    remove_action('generate_after_header', 'generate_add_navigation_after_header', 5);

    #28988
    Tom
    Lead Developer
    Lead Developer

    That should go in your functions.php file or in a new plugin you can create easily with a plugin called “Pluginception”.

    I updated the Gist so the remove action should fire: https://gist.github.com/generatepress/47e6abb67b41883e1910

    If “after_setup_theme” doesn’t work, try “wp”.

    I won’t be around most of today – but will check back as soon as I get back in my office.

    #28989
    Krzysztof

    Yeah, now it’s work perfect πŸ˜€ Thank You Tom!

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