[wp-trac] [WordPress Trac] #16679: wp_nav_menu treats menu_class differently for fallback

WordPress Trac wp-trac at lists.automattic.com
Sat Feb 26 16:39:24 UTC 2011


#16679: wp_nav_menu treats menu_class differently for fallback
--------------------------+-----------------------------
 Reporter:  Nonchalant    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Menus         |    Version:  3.1
 Severity:  normal        |   Keywords:  needs-testing
--------------------------+-----------------------------
 ''I've found references to this issue, but no actual solution or prior
 ticket. Issue:''

 When using wp_nav_menu, the output manner of menu_class is different
 depending if a fallback is being used or not.

 Menu:


 {{{
 $wp_nav_header = array(
     'theme_location' => 'primaryheader',
     'menu'            => '',
     'container'       => false,
     'container_class' => '',
     'container_id'    => '',
     'menu_class'      => 'sf-menu',
     'menu_id'         => '',
     'fallback_cb'     => 'wp_page_menu',
     'before'          => '',
     'after'           => '',
     'link_before'     => '',
     'link_after'      => '',
     'depth'           => 0,);
 wp_nav_menu( $wp_nav_header);
 }}}


 Output '''without''' Fallback (Correct output):


 {{{
 <ul id="menu-default" class="sf-menu"><li...
 }}}


 Output '''with''' Fallback (Incorrect output):


 {{{
 <div class="sf-menu"><ul><li...
 }}}


 So despite setting 'sf-menu' in menu_class, it creates a container (which
 I had explicitly disabled). It also does not populate the unordered list
 with the mentioned class.

 Thank you,

 Noel

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16679>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list