Ticket #13378: 13378.3.diff
File 13378.3.diff, 3.7 KB (added by , 14 years ago) |
---|
-
wp-includes/nav-menu-template.php
193 193 function wp_nav_menu( $args = array() ) { 194 194 $defaults = array( 'menu' => '', 'container' => 'div', 'container_class' => '', 'menu_class' => 'menu', 'echo' => true, 195 195 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 196 'depth' => 0, 'walker' => '', 'context' => 'frontend' );196 'depth' => 0, 'walker' => '', 'context' => 'frontend', 'slot' => '' ); 197 197 198 198 $args = wp_parse_args( $args, $defaults ); 199 199 $args = apply_filters( 'wp_nav_menu_args', $args ); … … 202 202 // Get the nav menu 203 203 $menu = wp_get_nav_menu_object( $args->menu ); 204 204 205 if ( ! $menu && $slot ) { 206 $slots = get_nav_menu_slots(); 207 if ( isset($slots) && isset($slots[$slot]) ) 208 $menu = wp_get_nav_menu_object( $slots['slot'] ); 209 } 210 205 211 // If we couldn't find a menu based off the menu argument 206 212 // get the first menu that has items. 207 213 if ( ! $menu ) { -
wp-includes/nav-menu.php
62 62 } 63 63 64 64 /** 65 * Register nav menus for a theme. 66 * 67 * @since 3.0.0 68 * 69 * @param array Associative array of menu slot identifiers and descriptions. 70 */ 71 function register_nav_menus( $menus = array() ) { 72 global $_wp_registered_nav_menus; 73 74 add_theme_support( 'nav-menus' ); 75 76 $_wp_registered_nav_menus = $menus; 77 } 78 79 function get_registered_nav_menus() { 80 global $_wp_registered_nav_menus; 81 82 return $_wp_registered_nav_menus; 83 } 84 85 function get_nav_menu_slots() { 86 return get_theme_mod('nav_menu_slots'); 87 } 88 89 /** 65 90 * Determine whether the given ID is a nav menu item. 66 91 * 67 92 * @since 3.0.0 -
wp-content/themes/twentyten/functions.php
80 80 add_theme_support( 'post-thumbnails' ); 81 81 82 82 // This theme uses wp_nav_menu() 83 add_theme_support( 'nav-menus');83 register_nav_menus( array('main' => __('Main Menu')) ); 84 84 85 85 // Add default posts and comments RSS feed links to head 86 86 add_theme_support( 'automatic-feed-links' ); -
wp-admin/nav-menus.php
482 482 <input name="menu-name" id="menu-name" type="text" class="menu-name regular-text menu-item-textbox input-with-default-title" title="Enter menu name here." value="<?php echo esc_attr( $nav_menu_selected_title ); ?>" /> 483 483 <br class="clear" /> 484 484 </label> 485 485 <?php if ( ! empty( $nav_menu_selected_id ) && $slots = get_registered_nav_menus() ) : ?> 486 <label class="menu-name-label howto open-label" for="menu-slot"> 487 <span><?php _e('Theme Slot'); ?></span> 488 <select id="menu-slot" name="menu-slot"> 489 <?php foreach ( $slots as $slot_key => $slot_text ) { 490 echo '<option value="' . esc_attr($slot_key) . '">' . esc_html($slot_text) . '</option>'; 491 } 492 ?> 493 </select> 494 <br class="clear" /> 495 </label> 496 <?php endif; ?> 486 497 <div class="publishing-action"> 487 498 <input class="button-primary" name="save_menu" type="submit" value="<?php empty($nav_menu_selected_id) ? esc_attr_e('Create Menu') : esc_attr_e('Save Menu'); ?>" /> 488 499 </div><!--END .publishing-action-->