Skip to main content
6 events
when toggle format what by license comment
Jul 28, 2011 at 23:23 vote accept stevendesu
Jul 28, 2011 at 23:23 comment added stevendesu I actually just realized (with the help of a response to stackoverflow.com/questions/6862887/…) that I can use wp_nav_menu_args to pass my own custom walker class. For the recommendation to look at available filters, I'm accepting this answer as it does answer the original question. Although I recently have a problem with my Walker class, I can make a new question for this...
Jul 28, 2011 at 22:35 comment added stevendesu Problem is (mentioned in the previous question) I wanted to make this plugin with the assumption that I had no power to edit the theme (since it will be used on multiple different themes and the client may likely change themes at some point in time). My solution so far was to copy/paste the code from nav-menu-template.php except for this line: $items .= walk_nav_menu_tree( $sorted_menu_items, $args->depth, $args );. I can change this line to implement my own walker. However this means wp_nav_menu() is essentially run twice, with the first output discarded. Kind of wasteful.
Jul 28, 2011 at 22:22 comment added kaiser Codex isn't up to date, that's why I linked Chips tutorial. For the $items, just inspect them step by step. Else use a custom walker.
Jul 28, 2011 at 22:19 comment added stevendesu For options I was going by WordPress's own documentation: codex.wordpress.org/Writing_a_Plugin Although I don't have any options yet. At the moment I'm making this a very simple plugin that will support one use case, then I'll expand it and add options as necessary. Although I have been reading through core.trac.wordpress.org/browser/tags/3.2.1/wp-includes/… to find the best method of accessing menu items. Since I want to edit the menu output and not the item list I think I may have to re-generate the item list (silly, I know)...
Jul 28, 2011 at 22:13 history answered kaiser CC BY-SA 3.0