WordPress Menu Walker Class for Foundation 5


I’ve been using Foundation for the past few years. Nearly all of my custom WordPress themes have been built on Foundation. However, it’s not without it’s minor faults. In this instance, the fault could be split in half, starting with WordPress’s default wp_page_menu menu function. If you’re developing a theme for a client, this isn’t an issue since you’re going to immediately attach them menu to a theme location on the menu panel page. But what if you are creating a theme for general use?

What I noticed upon activating my Foundation built theme was that the Top Bar was completely empty upon theme activation.

Why is this a problem?

From my observations, quite a few WordPress users DO NOT attach their navigation menus to a theme location, instead they just let the pages automatically add themselves to the top level menu. What you don’t want to hear/read is, “Dude, where is my menu”. Most don’t want to hear explanations about how Foundation’s Top Bar is incompatible with WordPress’s fallback wp_page_menu, so let’s apply a workaround instead.

Foundation 5 Menu Walker Class

And the Top Bar markup

And that’s it. I hope this helps. You can also fork this on my Github: https://github.com/wlcdesigns/foundation

And check out Ingleside, a Foundation based theme