[wp-trac] [WordPress Trac] #13910: Get Menu name with wp_nav_menu()

WordPress Trac wp-trac at lists.automattic.com
Tue Apr 17 16:49:20 UTC 2012


#13910: Get Menu name with wp_nav_menu()
-------------------------------------------------+-------------------------
 Reporter:  jowo                                 |       Owner:
     Type:  feature request                      |      Status:  new
 Priority:  normal                               |   Milestone:  Future
Component:  Menus                                |  Release
 Severity:  normal                               |     Version:  3.0
 Keywords:  has-patch needs-testing dev-         |  Resolution:
  feedback                                       |
-------------------------------------------------+-------------------------
Changes (by markoheijnen):

 * cc: marko@… (added)
 * keywords:  has-patch needs-testing gsoc => has-patch needs-testing dev-
     feedback


Comment:

 The patch looks wrong. title shouldn't be an argument and it should have
 been $menu->name.

 Also a function like this should be in core

 {{{
 <?
 function wp_nav_menu_title( $theme_location ) {
         $title = '';
         if ( $theme_location && ( $locations = get_nav_menu_locations() )
 && isset( $locations[ $theme_location ] ) ) {
                 $menu = wp_get_nav_menu_object( $locations[
 $theme_location ] );

                 if( $menu && $menu->name ) {
                         $title = $menu->name;
                 }
         }

         return apply_filters( 'wp_nav_menu_title', $title, $theme_location
 );
 }
 ?>
 }}}

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


More information about the wp-trac mailing list