[wp-hackers] wp_nav_menu too simplistic?
Otto
otto at ottodestruct.com
Tue Apr 6 20:24:21 UTC 2010
On Tue, Apr 6, 2010 at 3:17 PM, Otto <otto at ottodestruct.com> wrote:
> On Tue, Apr 6, 2010 at 3:13 PM, John Bloch <jbloch at olympianetworks.com> wrote:
>> This custom walker class will give you a filter to directly modify the
>> url of individual menu items. Put this into your theme's function file
>> and, when you call the menu, add "walker=Custom_Walker_Nav_Menu" to
>> the function's arguments.
>
> So what you're saying is that you can't make a plugin do it, it has to
> be a theme that does it, by modifying the call to wp_nav_menu.
Ahh, no, a plugin can do it. There's a filter you can use to force the
walker, "wp_nav_menu_args".
Rather a long way to go though. And it doesn't allow for multiple
plugins creating different types of menu items, since only one walker
can be used.
BTW, in your example, it would actually make more sense for
Custom_Walker_Nav_Menu to extend Walker_Nav_Menu. Then you could
override just the start_el function, leaving the rest alone.
-Otto
More information about the wp-hackers
mailing list