[wp-trac] [WordPress Trac] #14844: wp_nav_menu producing unexpected results

WordPress Trac wp-trac at lists.automattic.com
Sat Sep 11 14:09:55 UTC 2010


#14844: wp_nav_menu producing unexpected results
--------------------------+-------------------------------------------------
 Reporter:  holypixel     |       Owner:                         
     Type:  defect (bug)  |      Status:  new                    
 Priority:  normal        |   Milestone:  Awaiting Review        
Component:  Menus         |     Version:  3.0.1                  
 Severity:  normal        |    Keywords:  reporter-feedback close
--------------------------+-------------------------------------------------

Comment(by filosofo):

 Replying to [comment:3 holypixel]:
 > Technically, there is no reason why wordpress can't differentiate
 between children, or any menu item for that matter using the menu-item-id,
 as that is unique to every menu item. All that would be required is that
 when a menu item is selected by the user, wordpress creates a variable
 containing the selected menu-item-id to be used by the
 _wp_menu_item_classes_by_context function.

 I'm unsure what you mean by "selected by the user."  Do you mean, request
 the page represented by that menu link?  In other words, click one of the
 Item D menu links?

 If so, then the problem is that the link clicked is the same no matter
 which instance of Item D in the menu you follow: Item D on your left links
 to `http://example.com/item-d-page/`, and Item D on your right links to
 the same, `http://example.com/item-d-page/`.  How is WordPress supposed to
 know when you request `http://example.com/item-d-page/` whether you mean
 Item D on the left or the right?

 You mention children.  WordPress ''does'' distinguish ancestry for
 different children.  Say Item K is under right-hand Item D in the menu.
 Then when you request Item K's page, ''right-hand'' menu Item D gets the
 `current-menu-ancestor` class; left-hand menu Item D does not.  In that
 case, it there is a reasonable way to distinguish which Item D menu item
 should be affected, and WP does so.

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


More information about the wp-trac mailing list