[wp-hackers] wp_nav_menu too simplistic?

John Bloch jbloch at olympianetworks.com
Tue Apr 6 19:58:18 UTC 2010

Or you could declare your own Walker class, copying the exact nav menu
walker and just adding your own filters onto whatever you want, then just
use the new class name as the 'walker' attribute when you call the menu.

Also, there are filters and actions all over the menus. For example,
nav_menu_css_class is a hook that lets you sort through an array of classes
applied to each and every menu item and add or remove classes. That's just
one of at least a dozen that I saw while taking a cursory look through the
menu functions.

John P. Bloch

On Tue, Apr 6, 2010 at 3:27 PM, Otto <otto at ottodestruct.com> wrote:

> On Tue, Apr 6, 2010 at 2:16 PM, John Bloch <jbloch at olympianetworks.com>
> wrote:
> > Even without that pre-built functionality, there are still the normal
> hooks
> > that you have when updating a page. Nobody said it's easy to code such a
> > plugin; I just said that it was possible.
> Yuck. Okay, so I consider hacky ways of doing things to be invalid.
> Therefore, it is not possible. :)
> There's no action hooks or filters or anything in the menu generation
> system. Basically, the wp_setup_nav_menu_item builds the url and such,
> then that gets passed to wp_get_nav_menu_item which builds the link,
> and then it gets shoved into the output.
> Short of hideous regexp and filtering that whole menu and such,
> there's no way to insert stuff into the menu dynamically. All you can
> do is recognize changes and then modify the menu (and probably break
> it in the process, the ordering system is fragile as well).
> A better solution would be to make the menu system not all so focused
> on static links and use something more like widgets, which get called
> to build their link (and which could then be static, if desired). Then
> it'd be more configurable and more expandable.  Plus we wouldn't need
> all this Woo code for Ajax and such, since a widget system already
> exists and is in the core.
> -Otto
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

More information about the wp-hackers mailing list