[wp-trac] [WordPress Trac] #13793: Missing child_of parameter to wp_get_nav_menu_items

WordPress Trac wp-trac at lists.automattic.com
Wed Jun 16 11:12:55 UTC 2010


#13793: Missing child_of parameter to wp_get_nav_menu_items
-------------------------+--------------------------------------------------
 Reporter:  DreadLox     |        Owner:         
     Type:  enhancement  |       Status:  closed 
 Priority:  normal       |    Milestone:         
Component:  Menus        |      Version:  3.0    
 Severity:  normal       |   Resolution:  wontfix
 Keywords:  has-patch    |  
-------------------------+--------------------------------------------------

Comment(by AdmireNL):

 Replying to [comment:6 DreadLox]:
 > Replying to [comment:5 filosofo]:
 > > Replying to [comment:4 DreadLox]:
 > > > Also what my patch provides can't be achieved using a plugin. Maybe
 you could just add an action/filter, so such a functionality could be
 implemented using a plugin.
 > >
 > > Actually you can, a number of ways.  I would either call
 `wp_get_nav_menu_items` directly or extend the `Walker_Nav_Menu` class.
 >
 > When using `wp_get_nav_menu_items` directly I then miss all the
 wordpress great code that generates the html menu with classes etc...
 Extending `Walker_Nav_Menu` class is rather complicated.
 >
 > > What is the use-case for this feature?
 >
 > I have some websites where the first level of the menu get displayed as
 the website "top bar" menu. When one enters one of those, a submenu of
 that level get displayed in the sidebar. (plz excuse my bad english)
 >
 > So, I first get the current page's top parent ID and then:
 > if($TopParentId) wp_nav_menu( array('child_of'=>$TopParentId)  );
 >
 > Again if you really do not want such a specific feature just add a
 filter to menu_items:
 >
 > $menu_items = apply_filters( 'wp_nav_menu_items', $menu_items, $args );
 >
 > Thanks.
 >
 >
 >
 Hi Dreadlox, your comment seems to get very close to what I like to
 achieve, but I don't know how to get the 'TopParentId'[[BR]]

 {{{
 if($TopParentId) wp_nav_menu( array('child_of'=>$TopParentId)  );
 }}}

 Thanks a lot in advance!
 Arnoud

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/13793#comment:10>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list