- This topic has 8 replies, 2 voices, and was last updated 8 years ago by Krzysztof.
September 1, 2014 at 9:47 am #22689Krzysztof
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.September 1, 2014 at 10:39 am #22732TomLead DeveloperLead 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!September 12, 2014 at 9:41 am #28434TomLead DeveloperLead DeveloperSeptember 12, 2014 at 9:45 am #28437Krzysztof
Yes, I still need a walker – I must separate arrow that inform of existing submenu and show submenu only when cursor is above arrow 🙂September 13, 2014 at 8:30 am #28964TomLead DeveloperLead 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 🙂September 13, 2014 at 8:52 am #28986Krzysztof
Hmm I need to change something in GeneratePress files? Because now it doesn’t work and I have two navigation menu.September 13, 2014 at 9:04 am #28987Krzysztof
remove_action return false even when I changed it to:
remove_action('generate_after_header', 'generate_add_navigation_after_header', 5);September 13, 2014 at 9:09 am #28988TomLead DeveloperLead 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.September 13, 2014 at 9:14 am #28989Krzysztof
Yeah, now it’s work perfect 😀 Thank You Tom!
- You must be logged in to reply to this topic.