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

WordPress Trac wp-trac at lists.automattic.com
Sat Sep 11 13:41:42 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 holypixel):

 Yes you are right in the sense that Item D is identical, no matter what
 menu it is in, however to not be able to differentiate between instances
 from a semantic point of view is quite impractical, particularly when it
 comes to styling and creating child only side menus etc.

 Conceptually, yes it is possible to create two versions of item D (for
 example) which are different, however surely that defeats the purpose of
 allowing a single page to have multiple instances in the menu system
 (clearly an intended function of wp_nav_menu). Trying to explain to
 clients why they have to duplicate pages simply to keep the site
 functioning correctly confuses matters (many want pricing to appear in
 multiple menus for example).

 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.

 To be more specific, the _wp_menu_item_classes_by_context function in nav-
 menu-template currently works like so...

 $menu_item->object_id == $queried_object_id &&

 It would simply need to be changed to..

 $menu_item->ID == $selected_menu_item_id &&

 To me it just seems kind of pointless having a current-menu-item class
 that doesn't actually denote what it is supposed to denote...

 Thanks for your help... I dont mean to sound too direct!

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


More information about the wp-trac mailing list