Ticket #11817: ticket_11817_nav_menu_bugfixes_tweaks.diff
File ticket_11817_nav_menu_bugfixes_tweaks.diff, 111.4 KB (added by , 15 years ago) |
---|
-
wp-includes/nav-menu-template.php
1 1 <?php 2 3 2 /** 4 * Outputs a navigation menu.3 * Displays a navigation menu. 5 4 * 6 5 * Optional $args contents: 7 6 * … … 10 9 * menu_class - CSS class to use for the div container of the menu list. Defaults to 'menu'. 11 10 * format - Whether to format the ul. Defaults to 'div'. 12 11 * fallback_cb - If the menu doesn't exists, a callback function will fire. Defaults to 'wp_page_menu'. 12 * before_link - Output text before the link. 13 * after_link - Output text after the link. 14 * before_title - Output text before the link text. 15 * before_title - Output text after the link text. 16 * echo - Whether to echo the menu or return it. Defaults to echo. 13 17 * 14 18 * TODO: 15 19 * show_home - If you set this argument, then it will display the link to the home page. The show_home argument really just needs to be set to the value of the text of the link. 16 * link_before - Text before show_home argument text.17 * link_after - Text after show_home argument text.18 * echo - Whether to echo the menu or return it. Defaults to echo.19 20 * 20 21 * @since 3.0.0 21 22 * 22 23 * @param array $args Arguments 23 24 */ 24 25 function wp_nav_menu( $args = array() ) { 25 $defaults = array( 'id' => '', 'slug' => '', 'menu_class' => 'menu', 'format' => 'div', 'fallback_cb' => 'wp_page_menu', 'echo' => true, 'link_before' => '', 'link_after' => '' ); 26 $defaults = array( 'menu' => '', 'menu_class' => 'menu', 'format' => 'div', 'echo' => true, 27 'fallback_cb' => 'wp_page_menu', 'link_before' => '', 'link_after' => '', 'before_link' => '', 'after_link' => '', ); 28 26 29 $args = wp_parse_args( $args, $defaults ); 30 $args = apply_filters( 'wp_nav_menu_args', $args ); 27 31 $args = (object) $args; 28 32 29 // Get the menu 30 $menu = null; 31 if ( !empty($args->id) ) { 32 $menu = wp_get_nav_menu( $args->id ); 33 } elseif ( !empty($args->slug) ) { 34 $menu = get_term_by( 'slug', $args->slug, 'nav_menu' ); 35 } else { 33 // Get the nav menu 34 $menu = wp_get_nav_menu_object( $args->menu ); 35 36 // If we couldn't find a menu based off the name, id or slug, 37 // get the first menu that has items. 38 if ( !$menu ) { 36 39 $menus = wp_get_nav_menus(); 37 40 foreach ( $menus as $menu_maybe ) { 38 41 if ( wp_get_nav_menu_items($menu_maybe->term_id) ) { … … 42 45 } 43 46 } 44 47 45 // If the menu doesn't exists, call the fallback_cb 46 if ( !$menu || is_wp_error($menu) ) 47 return call_user_func($args->fallback_cb, $args ); 48 48 $args->menu = $menu->term_id; 49 $nav_menu = ''; 50 49 51 if ( 'div' == $args->format ) 50 echo '<div class="' . esc_attr($args->menu_class) . '"><ul>'; 51 52 $args->id = $menu->term_id; 53 54 wp_print_nav_menu($args); 55 52 $nav_menu .= '<div id="menu-'. $menu->slug .'" class="' . esc_attr($args->menu_class) . '">'; 53 54 $nav_menu .= wp_get_nav_menu( $args ); 55 56 56 if ( 'div' == $args->format ) 57 echo '</ul></div>'; 57 $nav_menu .= '</div>'; 58 59 $nav_menu = apply_filters( 'wp_nav_menu', $nav_menu ); 60 61 return $args->echo ? print $nav_menu : $nav_menu; 58 62 } 59 63 60 function wp_print_nav_menu( $args = array() ) { 61 // Defaults 62 $defaults = array( 'type' => 'frontend', 'name' => 'Menu 1', 'id' => 0, 'desc' => 2, 'before_title' => '', 'after_title' => ''); 63 64 $args = wp_parse_args($args, $defaults); 65 extract($args, EXTR_SKIP); 66 67 $menu_items = wp_get_nav_menu_items( $id ); 68 69 $parent_stack = array(); 70 $current_parent = 0; 71 $parent_menu_order = array(); 72 // Setup parentage 73 foreach ( $menu_items as $menu_item ) { 74 $parent_menu_order[ $menu_item->ID ] = $menu_item->menu_order; 64 /** 65 * Returns a Navigation Menu. 66 * 67 * See wp_nav_menu() for args. 68 * 69 * @since 3.0.0 70 * 71 * @param array $args Arguments 72 * @return mixed $output False if menu doesn't exists, else, returns the menu. 73 **/ 74 function wp_get_nav_menu( $args = array() ) { 75 $defaults = array( 'menu' => '', 'menu_class' => 'menu', 'ul_class' => '', 'format' => 'div', 'type' => 'frontend', 76 'fallback_cb' => '', 'link_before' => '', 'link_after' => '', 'before_link' => '', 'after_link' => '', ); 77 78 $args = wp_parse_args( $args, $defaults ); 79 $args = apply_filters( 'wp_get_nav_menu_args', $args ); 80 $args = (object) $args; 81 82 $menu = wp_get_nav_menu_object( $args->menu ); 83 84 // If no menu was found, call the fallback_cb 85 if ( !$menu || is_wp_error($menu) ) { 86 if ( function_exists($args->fallback_cb) ) 87 return call_user_func( $args->fallback_cb, $args ); 88 } 89 90 $menu_items = wp_get_nav_menu_items( $menu->term_id ); 91 $nav_menu = ''; 92 $parent_stack = array(); 93 $current_parent = 0; 94 $parent_menu_order = array(); 95 96 // Setup parentage 97 foreach ( $menu_items as $menu_item ) 98 $parent_menu_order[ $menu_item->ID ] = $menu_item->menu_order; 99 100 $ul_class = isset($args->ul_class) ? ' class="'. $args->ul_class .'"' : ''; 101 $nav_menu .= '<ul'. $ul_class .'>'; 102 103 // Display Loop 104 foreach ( $menu_items as $key => $menu_item ) : 105 // Setup the $menu_item variables 106 $menu_item = wp_setup_nav_menu_item( $menu_item ); 107 108 $maybe_value = 'frontend' == $args->type ? '' : ' value="'. $menu_item->ID .'"'; 109 $classes = 'frontend' == $args->type ? 'class="menu-item-'. $menu_item->type . $menu_item->li_class .'"' : ''; 110 111 $nav_menu .= '<li id="menu-item-'. $menu_item->ID .'"'. $maybe_value . $classes .'>'; 112 $nav_menu .= wp_get_nav_menu_item( $menu_item, $args->type, $args ); 113 114 // Indent children 115 $last_item = ( count( $menu_items ) == $menu_item->menu_order ); 116 if ( $last_item || $current_parent != $menu_items[ $key + 1 ]->post_parent ) { 117 if ( $last_item || in_array( $menu_items[ $key + 1 ]->post_parent, $parent_stack ) ) { 118 $nav_menu .= '</li>'; 119 while ( !empty( $parent_stack ) && ($last_item || $menu_items[ $key + 1 ]->post_parent != $current_parent ) ) { 120 $nav_menu .= '</ul></li>'; 121 $current_parent = array_pop( $parent_stack ); 122 } 123 } else { 124 array_push( $parent_stack, $current_parent ); 125 $current_parent = $menu_item->ID; 126 $nav_menu .= '<ul>'; 127 } 128 } else { 129 $nav_menu .= '</li>'; 75 130 } 76 77 // Display Loop 78 foreach ( $menu_items as $key => $menu_item ) { 79 $menu_item = wp_setup_nav_menu_item($menu_item); 80 // List Items 81 ?><li id="menu-<?php echo $menu_item->ID; ?>" value="<?php echo $menu_item->ID; ?>" <?php echo $menu_item->li_class; ?>><?php 82 wp_print_nav_menu_item($menu_item, $type, $args); 83 // Indent children 84 $last_item = ( count( $menu_items ) == $menu_item->menu_order ); 85 if ( $last_item || $current_parent != $menu_items[ $key + 1 ]->post_parent ) { 86 if ( $last_item || in_array( $menu_items[ $key + 1 ]->post_parent, $parent_stack ) ) { ?> 87 </li> 88 <?php while ( !empty( $parent_stack ) && ($last_item || $menu_items[ $key + 1 ]->post_parent != $current_parent ) ) { ?> 89 </ul> 90 </li> 91 <?php $current_parent = array_pop( $parent_stack ); 92 } ?> 93 <?php } else { 94 array_push( $parent_stack, $current_parent ); 95 $current_parent = $menu_item->ID; ?> 96 <ul> 97 <?php } 98 } else { ?> 99 </li> 100 <?php } 101 } 131 132 endforeach; 133 134 $nav_menu .= '</ul>'; 135 136 return apply_filters( 'wp_get_nav_menu', $nav_menu ); 102 137 } 103 138 104 function wp_print_nav_menu_item( $menu_item, $context, $args = array() ) { 139 /** 140 * Returns a menu item. 141 * 142 * @since 3.0.0 143 * 144 * @param object $menu_item The menu item 145 * @param string $context frontend|backend|default 146 * @param array $args See wp_get_nav_menu(). 147 **/ 148 function wp_get_nav_menu_item( $menu_item, $context, $args = array() ) { 149 $item = ''; 105 150 switch ( $context ) { 151 case 'frontend': 152 $attr_title = ( isset($menu_item->anchor_title) && '' != $menu_item->anchor_title ) ? ' title="'. esc_attr($menu_item->anchor_title) .'"' : ''; 153 $href = isset($menu_item->link) ? ' href="'. esc_url($menu_item->link) .'"' : ''; 154 155 $item .= '<a'. $attr_title . $href . $menu_item->target .'>'; 156 $item .= $args->before_link . esc_html( $menu_item->title ) . $args->after_link; 157 $item .= '</a>'; 158 159 break; 160 106 161 case 'backend': 107 case 'menu': 108 ?> 109 <dl> 110 <dt> 111 <span class="item-title"><?php echo esc_html($menu_item->title); ?></span> 112 <span class="item-controls"> 113 <span class="item-type"><?php echo esc_html($menu_item->type); ?></span> 114 <a class="item-edit thickbox" id="edit<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( $menu_item->menu_order ); ?>" title="<?php _e('Edit Menu Item'); ?>" href="#TB_inline?height=380&width=300&inlineId=menu-item-settings"><?php _e('Edit'); ?></a> | 115 <a class="item-delete" id="delete<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( $menu_item->menu_order ); ?>"><?php _e('Delete'); ?></a> 116 </span> 117 </dt> 118 </dl> 119 <?php if ( 'backend' == $context ) { ?> 120 <a><span class=""></span></a> 121 <?php } else { ?> 122 <a class="hide" href="<?php echo $menu_item->link; ?>"><?php echo esc_html( $menu_item->title ); ?></a> 123 <?php } ?> 124 <input type="hidden" name="dbid<?php echo esc_attr( $menu_item->menu_order ); ?>" id="dbid<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( $menu_item->ID ); ?>" /> 125 <input type="hidden" name="postmenu<?php echo esc_attr( $menu_item->menu_order ); ?>" id="postmenu<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( get_post_meta( $menu_item->ID, 'object_id', true ) ); ?>" /> 126 <input type="hidden" name="parent<?php echo esc_attr( $menu_item->menu_order ); ?>" id="parent<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( $menu_item->parent_item ); ?>" /> 127 <input type="hidden" name="icon<?php echo esc_attr( $menu_item->menu_order ); ?>" id="icon<?php echo esc_attr( $menu_item->menu_order ); ?>" value="0" /> 128 <input type="hidden" name="position<?php echo esc_attr( $menu_item->menu_order ); ?>" id="position<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( $menu_item->menu_order ); ?>" /> 129 <input type="hidden" name="linktype<?php echo esc_attr( $menu_item->menu_order ); ?>" id="linktype<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( get_post_meta( $menu_item->ID, 'menu_type', true ) ); ?>" /> 130 <input type="hidden" name="item-title<?php echo esc_attr( $menu_item->menu_order ); ?>" id="item-title<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( $menu_item->title ); ?>" /> 131 <input type="hidden" name="item-url<?php echo esc_attr( $menu_item->menu_order ); ?>" id="item-url<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( $menu_item->link ); ?>" /> 132 <input type="hidden" name="item-description<?php echo esc_attr( $menu_item->menu_order ); ?>" id="item-description<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( $menu_item->description ); ?>" /> 133 <input type="hidden" name="item-attr-title<?php echo esc_attr( $menu_item->menu_order ); ?>" id="item-attr-title<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( $menu_item->post_excerpt ); ?>" /> 134 <input type="hidden" name="item-target<?php echo esc_attr( $menu_item->menu_order ); ?>" id="item-target<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo ( get_post_meta( $menu_item->ID, 'menu_new_window', true ) ? '1' : '0' ); ?>" /> 135 <?php 136 break; 137 138 case 'frontend': 139 // Override for menu descriptions 140 $advanced_option_descriptions = get_option('wp_settings_nav_menu_advanced_options'); 141 if ( $advanced_option_descriptions == 'no' ) 142 $args['desc'] = 2; 143 ?> 144 <a title="<?php echo esc_attr( $menu_item->anchor_title ); ?>" href="<?php echo esc_url( $menu_item->link ); ?>" <?php echo $menu_item->target; ?>><?php echo $args['before_title'] . esc_html( $menu_item->title ) . $args['after_title']; ?><?php 145 146 if ( $advanced_option_descriptions == 'no' ) { 147 // 2 widget override do NOT display descriptions 148 // 1 widget override display descriptions 149 // 0 widget override not set 150 if ( ($args['desc'] == 1) || ($args['desc'] == 0) ) { 151 ?><span class="nav-description"><?php echo $menu_item->description; ?></span><?php 152 } 153 } else { 154 // 2 widget override do NOT display descriptions 155 // 1 widget override display descriptions 156 // 0 widget override not set 157 if ( $args['desc'] == 1 ) { 158 ?><span class="nav-description"><?php echo $menu_item->description; ?></span><?php 159 } 160 } 161 ?></a> 162 <?php 163 break; 164 162 $item .= '<dl><dt>'; 163 $item .= '<span class="item-title">'. esc_html($menu_item->title) .'</span>'; 164 $item .= '<span class="item-controls">'; 165 $item .= '<span class="item-type">'. esc_html($menu_item->type) .'</span>'; 166 167 // Actions 168 $item .= '<a class="item-edit thickbox" id="edit'. esc_attr( $menu_item->menu_order ) .'" value="'. esc_attr( $menu_item->menu_order ) .'" title="'. __('Edit Menu Item') .'" href="#TB_inline?height=380&width=300&inlineId=menu-item-settings">'. __('Edit') .'</a> | '; 169 $item .= '<a class="item-delete" id="delete'. esc_attr( $menu_item->menu_order ) .'" value="'. esc_attr( $menu_item->menu_order ) .'">'. __('Delete') .'</a>'; 170 171 $item .= '</dt></dl>'; 172 173 // Menu Item Settings 174 $item .= '<input type="hidden" id="item-dbid'. esc_attr( $menu_item->menu_order ) .'" name="item-dbid'. esc_attr( $menu_item->menu_order ) .'" value="'. esc_attr( $menu_item->ID ) .'" />'; 175 $item .= '<input type="hidden" id="item-postmenu'. esc_attr( $menu_item->menu_order ) .'" name="item-postmenu'. esc_attr( $menu_item->menu_order ) .'" value="'. esc_attr( get_post_meta( $menu_item->ID, 'object_id', true ) ) .'" />'; 176 $item .= '<input type="hidden" id="item-parent'. esc_attr( $menu_item->menu_order ) .'" name="item-parent'. esc_attr( $menu_item->menu_order ) .'" value="'. esc_attr( $menu_item->parent_item ) .'" />'; 177 $item .= '<input type="hidden" id="item-position'. esc_attr( $menu_item->menu_order ) .'" name="item-position'. esc_attr( $menu_item->menu_order ) .'" value="'. esc_attr( $menu_item->menu_order ) .'" />'; 178 $item .= '<input type="hidden" id="item-type'. esc_attr( $menu_item->menu_order ) .'" name="item-type'. esc_attr( $menu_item->menu_order ) .'" value="'. esc_attr( get_post_meta( $menu_item->ID, 'menu_type', true ) ) .'" />'; 179 $item .= '<input type="hidden" id="item-title'. esc_attr( $menu_item->menu_order ) .'" name="item-title'. esc_attr( $menu_item->menu_order ) .'" value="'. esc_attr( $menu_item->title ) .'" />'; 180 $item .= '<input type="hidden" id="item-url'. esc_attr( $menu_item->menu_order ) .'" name="item-url'. esc_attr( $menu_item->menu_order ) .'" value="'. esc_attr( $menu_item->link ) .'" />'; 181 $item .= '<input type="hidden" id="item-description'. esc_attr( $menu_item->menu_order ) .'" name="item-description'. esc_attr( $menu_item->menu_order ) .'" value="'. esc_attr( $menu_item->description ) .'" />'; 182 $item .= '<input type="hidden" id="item-attr-title'. esc_attr( $menu_item->menu_order ) .'" name="item-attr-title'. esc_attr( $menu_item->menu_order ) .'" value="'.esc_attr( $menu_item->post_excerpt ) .'" />'; 183 $item .= '<input type="hidden" id="item-target'. esc_attr( $menu_item->menu_order ) .'" name="item-target'. esc_attr( $menu_item->menu_order ) .'" value="'. esc_attr( get_post_meta( $menu_item->ID, 'menu_new_window', true ) ? '1' : '0' ) .'" />'; 184 break; 185 165 186 case 'default': 166 187 $menu_id = 'menu-item-' . $menu_item->ID; 167 ?> 168 <dl> 169 <dt> 170 <label class="item-title"><input type="checkbox" id="<?php echo esc_attr($menu_id); ?>" onclick="wp_update_queue('<?php echo esc_js( $menu_item->append ); ?>','<?php echo esc_js( $menu_item->title ); ?>','<?php echo esc_js( $menu_item->link ); ?>','<?php echo esc_js( $menu_item->ID ); ?>','<?php echo esc_js( $menu_item->parent_item ); ?>','<?php echo esc_js( $menu_item->description ); ?>')" name="<?php echo esc_attr( $menu_item->title ); ?>" value="<?php echo esc_attr( $menu_item->link ); ?>" /><?php echo $menu_item->title; ?></label> 171 </dt> 172 </dl> 173 <?php 174 break; 188 $item .= '<label class="item-title"><input type="checkbox" id="'. esc_attr($menu_id) .'" name="'. esc_attr( $menu_item->title ) .'" value="'. esc_attr( $menu_item->link ) .'" />'. $menu_item->title .'</label>'; 189 190 // Menu Item Settings 191 $item .= '<input type="hidden" class="item-type" value="'. esc_attr( $menu_item->append ) .'" />'; 192 $item .= '<input type="hidden" class="item-title" value="'. esc_attr( $menu_item->title ) .'" />'; 193 $item .= '<input type="hidden" class="item-url" value="'. esc_attr( $menu_item->link ) .'" />'; 194 $item .= '<input type="hidden" class="item-dbid" value="'. esc_attr( $menu_item->ID ) .'" />'; 195 $item .= '<input type="hidden" class="item-parent" value="'. esc_attr( $menu_item->parent_item ) .'" />'; 196 $item .= '<input type="hidden" class="item-description" value="'. esc_attr( $menu_item->description ) .'" />'; 197 break; 175 198 } 199 return apply_filters( 'wp_get_nav_menu_item', $item ); 176 200 } 177 178 201 ?> 179 No newline at end of file -
wp-includes/default-widgets.php
1044 1044 class WP_Nav_Menu_Widget extends WP_Widget { 1045 1045 1046 1046 function WP_Nav_Menu_Widget() { 1047 $widget_ops = array( 'description' => __('Use this widget to add one of your navigation menus as a widget.') );1048 parent::WP_Widget( false, __('Navigation Menu'), $widget_ops );1047 $widget_ops = array( 'description' => __('Use this widget to add one of your navigation menus as a widget.') ); 1048 parent::WP_Widget( 'nav_menu', __('Navigation Menu'), $widget_ops ); 1049 1049 } 1050 1050 1051 1051 function widget($args, $instance) { 1052 $navmenu = $instance['navmenu'];1053 $navtitle = $instance['navtitle'];1054 $navdeveloper = strtolower($instance['navdeveloper']);1055 $navdiv = strtolower($instance['navdiv']);1056 $navul = strtolower($instance['navul']);1057 $navdivid = $instance['navdivid'];1058 $navdivclass = $instance['navdivclass'];1059 $navulid = $instance['navulid'];1060 $navulclass = $instance['navulclass'];1061 1062 // Override for menu descriptions1063 $advanced_option_descriptions = get_option('wp_settings_nav_menu_advanced_options');1064 if ( $advanced_option_descriptions == 'no' ) {1065 $navwidgetdescription = 2;1066 } else {1067 $navwidgetdescription = $instance['navwidgetdescription'];1068 }1069 1070 1052 // Get menu 1071 if ( $navmenu > 0 ) { 1072 $custom_menu = get_term( (int) $nav_menu, 'nav_menu' ); 1073 $wp_custom_nav_menu_name = $custom_menu->name; 1074 $menuexists = true; 1075 } else { 1076 $menuexists = false; 1077 } 1078 1079 if ( $navdeveloper == 'yes' ) { 1080 // DISPLAY Custom DIV 1081 if ( $navdiv == 'yes' ) { 1082 ?> 1083 <div id="<?php echo $navdivid; ?>" class="<?php echo $navdivclass; ?>"> 1084 <?php 1085 } 1086 } else { 1087 //DISPLAY default DIV 1088 ?> 1089 <div class="widget"> 1090 <?php 1091 } 1092 ?> 1093 1094 <h3><?php echo $navtitle; ?></h3> 1095 <?php 1096 if ( $menuexists ) { 1097 if ( $navdeveloper == 'yes' ) { 1098 //DISPLAY Custom UL 1099 if ( $navul == 'yes' ) { 1100 ?> 1101 <ul id="<?php echo $navulid; ?>" class="<?php echo $navulclass; ?>"> 1102 <?php 1103 } 1104 } else { 1105 // DISPLAY default UL 1106 ?> 1107 <ul class="menu"> 1108 <?php 1109 } 1110 wp_nav_menu( array('id' => $navmenu, 'name' => $wp_custom_nav_menu_name, 'desc' => $navwidgetdescription, 'format' => 'widget') ); 1111 if ( $navdeveloper == 'yes' ) { 1112 // DISPLAY Custom UL 1113 if ( $navul == 'yes' ) { 1114 ?> 1115 </ul> 1116 <?php 1117 } 1118 } else { 1119 // DISPLAY default UL 1120 ?> 1121 </ul> 1122 <?php 1123 } 1124 } else { 1125 _e('You have not setup the custom navigation widget correctly, please check your settings in the backend.'); 1126 } 1127 1128 //DEVELOPER settings enabled 1129 if ($navdeveloper == 'yes') { 1130 // DISPLAY Custom DIV 1131 if ( $navdiv == 'yes' ) { 1132 ?> 1133 </div> 1134 <?php 1135 } 1136 } else { 1137 // DISPLAY default DIV 1138 ?> 1139 </div> 1140 <?php 1141 } 1142 ?><!-- /#nav-container --> 1143 <?php 1053 $nav_menu = wp_get_nav_menu_object( $instance['nav_menu'] ); 1054 1055 if ( !$nav_menu ) 1056 return; 1057 1058 echo $args['before_widget']; 1059 1060 if ( isset($instance['title']) ) 1061 echo $args['before_title'] . $instance['title'] . $args['after_title']; 1062 1063 wp_nav_menu( array( 'menu' => $nav_menu ) ); 1064 1065 echo $args['after_widget']; 1144 1066 } 1145 1067 1146 function update($new_instance, $old_instance) { 1147 return $new_instance; 1068 function update( $new_instance, $old_instance ) { 1069 $instance['title'] = strip_tags( stripslashes($new_instance['title']) ); 1070 $instance['nav_menu'] = (int) $new_instance['nav_menu']; 1071 return $instance; 1148 1072 } 1149 1073 1150 function form($instance) { 1151 $navmenu = esc_attr($instance['navmenu']); 1152 $navtitle = esc_attr($instance['navtitle']); 1153 $navdeveloper = esc_attr($instance['navdeveloper']); 1154 $navdiv = esc_attr($instance['navdiv']); 1155 $navul = esc_attr($instance['navul']); 1156 $navdivid = esc_attr($instance['navdivid']); 1157 $navdivclass = esc_attr($instance['navdivclass']); 1158 $navulid = esc_attr($instance['navulid']); 1159 $navulclass = esc_attr($instance['navulclass']); 1160 $navwidgetdescription = esc_attr($instance['navwidgetdescription']); 1161 1162 global $wpdb; 1163 1074 function form( $instance ) { 1075 $title = isset( $instance['title'] ) ? $instance['title'] : ''; 1076 $nav_menu = isset( $instance['nav_menu'] ) ? $instance['nav_menu'] : ''; 1077 1164 1078 // Get menus 1165 $custom_menus = get_terms( 'nav_menu', array( 'hide_empty' => false ) ); 1166 1167 if ( !$custom_menus) { 1168 ?> 1169 <p> 1170 <label><?php printf(__('No menus have been created yet. <a href="%s">Creat some</a>.'), admin_url('nav-menus.php')); ?></label> 1171 </p> 1172 <?php 1079 $menus = get_terms( 'nav_menu', array( 'hide_empty' => false ) ); 1080 1081 // If no menus exists, direct the user to go and create some. 1082 if ( !$menus ) { 1083 echo '<p>'. sprintf( __('No menus have been created yet. <a href="%s">Creat some</a>.'), admin_url('nav-menus.php') ) .'</p>'; 1173 1084 return; 1174 1085 } 1175 1086 ?> 1176 1177 1087 <p> 1178 <label for="<?php echo $this->get_field_id('navmenu'); ?>"><?php _e('Select Menu:'); ?></label> 1179 1180 <select id="<?php echo $this->get_field_id('navmenu'); ?>" name="<?php echo $this->get_field_name('navmenu'); ?>"> 1181 <?php 1182 foreach ( $custom_menus as $menu ) { 1183 if ( $navmenu == $menu->term_id ) 1184 $selected_option = 'selected="selected"'; 1185 else 1186 $selected_option = ''; 1187 ?> 1188 <option value="<?php echo $menu->term_id; ?>" <?php echo $selected_option; ?>><?php echo $menu->name; ?></option> 1189 <?php 1190 } 1191 ?> 1192 </select> 1088 <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label> 1089 <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $title; ?>" /> 1193 1090 </p> 1194 1195 1091 <p> 1196 <label for="<?php echo $this->get_field_id('navtitle'); ?>"><?php _e('Title:'); ?></label> 1197 <input type="text" name="<?php echo $this->get_field_name('navtitle'); ?>" value="<?php echo $navtitle; ?>" class="widefat" id="<?php echo $this->get_field_id('navtitle'); ?>" /> 1198 </p> 1199 1200 <?php $checked = strtolower($navdeveloper); ?> 1201 <p> 1202 <label for="<?php echo $this->get_field_id('navdeveloper'); ?>"><?php _e('Advanced Options:'); ?></label><br /> 1203 <span class="checkboxes"> 1204 <label>Yes</label><input type="radio" id="<?php echo $this->get_field_name('navdeveloper'); ?>" name="<?php echo $this->get_field_name('navdeveloper'); ?>" value="yes" <?php if ($checked=='yes') { echo 'checked="checked"'; } ?> /> 1205 <label>No</label><input type="radio" id="<?php echo $this->get_field_name('navdeveloper'); ?>" name="<?php echo $this->get_field_name('navdeveloper'); ?>" value="no" <?php if ($checked=='yes') { } else { echo 'checked="checked"'; } ?> /> 1206 </span><!-- /.checkboxes --> 1207 </p> 1208 1092 <label for="<?php echo $this->get_field_id('nav_menu'); ?>"><?php _e('Select Menu:'); ?></label> 1093 <select id="<?php echo $this->get_field_id('nav_menu'); ?>" name="<?php echo $this->get_field_name('nav_menu'); ?>"> 1209 1094 <?php 1210 // Advanced settings 1211 if ( $checked == 'yes' ) : 1095 foreach ( $menus as $menu ) { 1096 $selected = $nav_menu == $menu->term_id ? ' selected="selected"' : ''; 1097 echo '<option'. $selected .' value="'. $menu->term_id .'">'. $menu->name .'</option>'; 1098 } 1212 1099 ?> 1213 <p> 1214 <?php $checked = strtolower($navdiv); ?> 1215 <label for="<?php echo $this->get_field_id('navdiv'); ?>"><?php _e('Wrap in container DIV:'); ?></label><br /> 1216 <span class="checkboxes"> 1217 <label>Yes</label><input type="radio" id="<?php echo $this->get_field_name('navdiv'); ?>" name="<?php echo $this->get_field_name('navdiv'); ?>" value="yes" <?php if ($checked=='yes') { echo 'checked="checked"'; } ?> /> 1218 <label>No</label><input type="radio" id="<?php echo $this->get_field_name('navdiv'); ?>" name="<?php echo $this->get_field_name('navdiv'); ?>" value="no" <?php if ($checked=='yes') { } else { echo 'checked="checked"'; } ?> /> 1219 </span><!-- /.checkboxes --> 1100 </select> 1220 1101 </p> 1221 1102 <?php 1222 if ( $checked == 'yes' ) {1223 ?>1224 1225 <p>1226 <label for="<?php echo $this->get_field_id('navdivid'); ?>"><?php _e('DIV id:'); ?></label>1227 <input type="text" name="<?php echo $this->get_field_name('navdivid'); ?>" value="<?php echo $navdivid; ?>" class="widefat" id="<?php echo $this->get_field_id('navdivid'); ?>" />1228 </p>1229 <p>1230 <label for="<?php echo $this->get_field_id('navdivclass'); ?>"><?php _e('DIV class:'); ?></label>1231 <input type="text" name="<?php echo $this->get_field_name('navdivclass'); ?>" value="<?php echo $navdivclass; ?>" class="widefat" id="<?php echo $this->get_field_id('navdivclass'); ?>" />1232 </p>1233 <?php1234 }1235 1236 $checked = strtolower($navul);1237 ?>1238 1239 <p>1240 <label for="<?php echo $this->get_field_id('navul'); ?>"><?php _e('Wrap in container UL:'); ?></label><br />1241 <span class="checkboxes">1242 <label>Yes</label><input type="radio" id="<?php echo $this->get_field_name('navul'); ?>" name="<?php echo $this->get_field_name('navul'); ?>" value="yes" <?php if ($checked=='yes') { echo 'checked="checked"'; } ?> />1243 <label>No</label><input type="radio" id="<?php echo $this->get_field_name('navul'); ?>" name="<?php echo $this->get_field_name('navul'); ?>" value="no" <?php if ($checked=='yes') { } else { echo 'checked="checked"'; } ?> />1244 </span><!-- /.checkboxes -->1245 </p>1246 1247 <?php1248 if ( $checked == 'yes' ) {1249 ?>1250 <p>1251 <label for="<?php echo $this->get_field_id('navulid'); ?>"><?php _e('UL id:'); ?></label>1252 <input type="text" name="<?php echo $this->get_field_name('navulid'); ?>" value="<?php echo $navulid; ?>" class="widefat" id="<?php echo $this->get_field_id('navulid'); ?>" />1253 </p>1254 <p>1255 <label for="<?php echo $this->get_field_id('navulclass'); ?>"><?php _e('UL class:'); ?></label>1256 <input type="text" name="<?php echo $this->get_field_name('navulclass'); ?>" value="<?php echo $navulclass; ?>" class="widefat" id="<?php echo $this->get_field_id('navulclass'); ?>" />1257 </p>1258 <?php1259 }1260 $advanced_option_descriptions = get_option('wp_settings_nav_menu_advanced_options');1261 ?>1262 <p <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?>>1263 <?php $checked = strtolower($navwidgetdescription); ?>1264 <label for="<?php echo $this->get_field_id('navwidgetdescription'); ?>"><?php _e('Show Top Level Descriptions:'); ?></label><br />1265 <span class="checkboxes">1266 <label>Yes</label><input type="radio" id="<?php echo $this->get_field_name('navwidgetdescription'); ?>" name="<?php echo $this->get_field_name('navwidgetdescription'); ?>" value="1" <?php if ($checked=='1') { echo 'checked="checked"'; } ?> />1267 <label>No</label><input type="radio" id="<?php echo $this->get_field_name('navwidgetdescription'); ?>" name="<?php echo $this->get_field_name('navwidgetdescription'); ?>" value="2" <?php if ($checked=='1') { } else { echo 'checked="checked"'; } ?> />1268 </span><!-- /.checkboxes -->1269 </p>1270 <?php1271 endif;1272 1103 } 1273 1104 } 1274 1105 -
wp-includes/nav-menu.php
7 7 * @since 3.0.0 8 8 */ 9 9 10 // Deletes a nav menu 11 function wp_delete_nav_menu( $menu_id ) { 12 $menu_id = (int) $menu_id; 13 if ( !$menu_id ) 14 return false; 10 /** 11 * Returns a Navigation Menu object 12 * 13 * @since 3.0.0 14 * 15 * @param string $menu Menu id 16 * @return mixed $menu|false 17 */ 18 function wp_get_nav_menu_object( $menu ) { 19 return is_nav_menu( $menu ); 20 } 15 21 16 $menu_objects = get_objects_in_term( $menu_id, 'nav_menu' ); 17 if ( !empty( $menu_objects ) ) { 18 foreach ( $menu_objects as $item ) { 19 wp_delete_post( $item ); 20 } 22 /** 23 * Check if Menu exists. 24 * 25 * Returns the menu object, or false if the term doesn't exist. 26 * 27 * @since 3.0.0 28 * 29 * @param int|string $menu The menu to check 30 * @return mixed Menu Object, if exists. 31 */ 32 function is_nav_menu( $menu ) { 33 if ( $menu ) { 34 $menu = get_term( $menu, 'nav_menu' ); 35 } elseif ( !$menu ) { 36 $menu = get_term_by( 'slug', $menu, 'nav_menu' ); 37 } elseif( !$menu ) { 38 $menu = get_term_by( 'name', $menu, 'nav_menu' ); 39 } else { 40 $menu = false; 21 41 } 22 wp_delete_term( $menu_id, 'nav_menu' ); 42 43 return $menu; 23 44 } 24 45 25 // Creates a new nav menu 46 /** 47 * Returns all Navigation Menu objects. 48 * 49 * @since 3.0.0 50 * 51 * @return array menu objects 52 */ 53 function wp_get_nav_menus() { 54 return get_terms( 'nav_menu', array( 'hide_empty' => false, 'orderby' => 'id' ) ); 55 } 56 57 /** 58 * Creates a navigation menu. 59 * 60 * Optional args: 61 * slug - the url friendly version of the nav menu. 62 * 63 * @since 3.0.0 64 * 65 * @param string $menu_name Menu Name 66 * @param string $args Optional. 67 * @return mixed Menu object|WP_Error 68 */ 26 69 function wp_create_nav_menu( $menu_name, $args = array() ) { 27 70 $menu_exists = get_term_by( 'name', $menu_name, 'nav_menu' ); 28 71 … … 39 82 if ( is_wp_error($menu) ) 40 83 return $menu; 41 84 42 return get_term( $menu['term_id'], 'nav_menu') ;85 return get_term( $menu['term_id'], 'nav_menu') ; 43 86 } 44 87 45 // Creates a default menu if none exists 88 /** 89 * Deletes a navigation menu. 90 * 91 * @since 3.0.0 92 * 93 * @param string $menu name|id|slug 94 * @return bool true on success, else false. 95 */ 96 function wp_delete_nav_menu( $menu ) { 97 $menu = wp_get_nav_menu_object( $menu ); 98 if ( !$menu ) 99 return false; 100 101 $menu_objects = get_objects_in_term( $menu->term_id, 'nav_menu' ); 102 if ( !empty( $menu_objects ) ) { 103 foreach ( $menu_objects as $item ) { 104 wp_delete_post( $item ); 105 } 106 } 107 wp_delete_term( $menu_id, 'nav_menu' ); 108 } 109 110 /** 111 * Creates a nav menu named 'Menu 1'. 112 * 113 * This function is called if the user doesn't have any nav menus. 114 * It grabs the first 14 pages, and creates a new default menu. 115 * 116 * @since 3.0.0 117 */ 46 118 function wp_create_default_nav_menu() { 47 119 $menu = wp_create_nav_menu( __('Menu 1'), array('slug' => 'menu-1') ); 48 120 … … 61 133 } 62 134 } 63 135 64 // Get nav menu by id 65 function wp_get_nav_menu( $menu ) { 66 return get_term( (int) $menu, 'nav_menu' ); 67 } 68 69 // Get all nav menus 70 function wp_get_nav_menus() { 71 return get_terms( 'nav_menu', array( 'hide_empty' => false, 'orderby' => 'id' ) ); 72 } 73 74 // Get the nav menu items 136 /** 137 * Returns the menu items of a navigation menu. 138 * 139 * @since 3.0.0 140 * 141 * @param string $menu menu name, id, or slug 142 * @param string $args 143 * @return mixed $items array of menu items, else false. 144 */ 75 145 function wp_get_nav_menu_items( $menu, $args = array() ) { 76 $items = get_objects_in_term( (int) $menu, 'nav_menu' ); 146 $menu = wp_get_nav_menu_object( $menu ); 147 148 if ( !$menu ) 149 return false; 150 151 $items = get_objects_in_term( $menu->term_id, 'nav_menu' ); 77 152 78 153 if ( ! empty( $items ) ) { 79 154 $defaults = array( 'orderby' => 'menu_order', 'post_type' => 'nav_menu_item', 'post_status' => 'publish', 'output' => ARRAY_A, 'output_key' => 'menu_order' ); 80 $args = wp_parse_args( $args, $defaults);155 $args = wp_parse_args( $args, $defaults ); 81 156 if ( count( $items ) > 1 ) 82 157 $args['include'] = implode( ',', $items ); 83 158 else … … 90 165 foreach ( $items as $item ) { 91 166 $output[$item->$args['output_key']] = $item; 92 167 } 93 unset( $items);94 ksort( $output);168 unset( $items ); 169 ksort( $output ); 95 170 return $output; 96 171 } 97 172 } 98 173 return $items; 99 174 } 100 175 101 // wp_setup_nav_menu_item() 102 function wp_setup_nav_menu_item($menu_item, $type = 'item', $position = 0) { 176 /** 177 * Returns a menu item with all it's nessecary data populated. 178 * 179 * @since 3.0.0 180 * 181 * @param string $menu_item Menu item. 182 * @param string $type item|category|page. 183 * @param string $position position of the menu item. 184 * @return $menu_item 185 */ 186 function wp_setup_nav_menu_item( $menu_item, $type = 'item', $position = 0 ) { 103 187 global $parent_menu_order; 104 188 105 189 if ( 'item' == $type ) { 106 $menu_item->type = get_post_meta( $menu_item->ID, 'menu_type', true);107 $menu_item->object_id = get_post_meta( $menu_item->ID, 'object_id', true);190 $menu_item->type = get_post_meta( $menu_item->ID, 'menu_type', true ); 191 $menu_item->object_id = get_post_meta( $menu_item->ID, 'object_id', true ); 108 192 $menu_item->target = ( get_post_meta( $menu_item->ID, 'menu_new_window', true ) ) ? 'target="_blank"' : ''; 109 193 if ( isset( $parent_menu_order[ $menu_item->post_parent ] ) ) 110 194 $menu_item->parent_item = $parent_menu_order[ $menu_item->post_parent ]; … … 165 249 166 250 $menu_item->li_class = ''; 167 251 global $wp_query; 168 if ( $menu_item->ID == $wp_query->get_queried_object_id() ) 169 $menu_item->li_class = 'class="current_page_item"'; 252 253 if ( $menu_item->object_id == $wp_query->get_queried_object_id() ) 254 $menu_item->li_class = ' current_page_item'; 170 255 171 256 $menu_item->anchor_title = ''; 172 257 /* @todo: update to use tax/post data … … 195 280 196 281 return $menu_item; 197 282 } 198 199 283 ?> 200 No newline at end of file -
wp-content/themes/twentyten/header.php
1 1 <!DOCTYPE html> 2 2 <html <?php language_attributes(); ?>> 3 3 <head> 4 5 4 <title><?php 5 if ( is_single() ) { 6 6 single_post_title(); echo ' | '; bloginfo('name'); 7 7 } elseif ( is_home() || is_front_page() ) { 8 8 bloginfo('name'); echo ' | '; bloginfo('description'); twentyten_the_page_number(); … … 15 15 } else { 16 16 wp_title(''); echo ' | '; bloginfo('name'); twentyten_the_page_number(); 17 17 } 18 18 ?></title> 19 19 20 20 <meta http-equiv="content-type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> 21 21 -
wp-admin/includes/nav-menu.php
1 1 <?php 2 2 3 /*-----------------------------------------------------------------------------------*/ 4 /* Custom Navigation Functions */ 5 /* wp_custom_navigation_output() displays the menu in the back/frontend 6 /* wp_custom_nav_get_pages() 7 /* wp_custom_nav_get_categories() 8 /* wp_custom_navigation_default_sub_items() is a recursive sub menu item function 9 /*-----------------------------------------------------------------------------------*/ 3 /** 4 * Displays a list of links and thier sub items. 5 * 6 * @since 3.0.0 7 * 8 * @param string $counter 9 * @param string $context 10 */ 11 function wp_nav_menu_get_custom_links( $counter, $context ) { 12 $available_links = new WP_Query( ); 13 14 $args = array( 'post_status' => 'any', 'post_type' => 'nav_menu_item', 'meta_value' => 'custom' ); 15 $link_objects = new WP_Query( $args ); 16 17 $items_counter = $counter; 10 18 11 // Outputs All Pages and Sub Items 12 function wp_nav_menu_get_pages($counter, $type) { 19 if ( !$link_objects->posts ) { 20 _e('Not Found'); 21 return $items_counter; 22 } 23 24 // Display Loop 25 foreach ( $link_objects->posts as $item ) { 26 if ( 0 == $item->parent ) { 27 $item = wp_setup_nav_menu_item( $item, 'item', $items_counter ); 28 29 switch ( $context ) { 30 case 'menu': 31 ?> 32 <li id="menu-<?php echo $items_counter; ?>" value="<?php echo $items_counter; ?>"> 33 <?php 34 echo wp_get_nav_menu_item( $item, 'menu' ); 35 $parentli = $item->ID; 36 $items_counter++; 37 $items_counter = wp_nav_menu_sub_items( $item->ID, $items_counter, $parentli, 'categories', 'menu' ); 38 ?> 39 </li> 40 <?php 41 break; 42 43 case 'default': 44 ?> 45 <li> 46 <?php 47 echo wp_get_nav_menu_item( $item, 'default' ); 48 $parentli = $item->ID; 49 $items_counter++; 50 $items_counter = wp_nav_menu_sub_items( $item->ID, $items_counter, $parentli, 'categories', 'default' ); 51 ?> 52 </li> 53 <?php 54 break; 55 } 56 } 57 } 58 return $items_counter; 59 } 13 60 61 /** 62 * Displays a list of pages and thier sub items. 63 * 64 * @since 3.0.0 65 * 66 * @param string $counter 67 * @param string $context 68 */ 69 function wp_nav_menu_get_pages( $counter, $context ) { 14 70 $pages_args = array( 15 71 'child_of' => 0, 16 72 'sort_order' => 'ASC', … … 26 82 'number' => '', 27 83 'offset' => 0 ); 28 84 29 // GETall pages30 $pages_array = get_pages( $pages_args);85 // Get all pages 86 $pages_array = get_pages( $pages_args ); 31 87 32 88 $items_counter = $counter; 33 89 $parentli = $items_counter; … … 40 96 // Display Loop 41 97 foreach ( $pages_array as $post ) { 42 98 if ( $post->post_parent == 0 ) { 43 $post = wp_setup_nav_menu_item( $post, 'page', $items_counter);44 if ( $ type== 'menu' ) {99 $post = wp_setup_nav_menu_item( $post, 'page', $items_counter ); 100 if ( $context == 'menu' ) { 45 101 ?> 46 47 102 <li id="menu-<?php echo $items_counter; ?>" value="<?php echo $items_counter; ?>"> 48 103 <?php 49 wp_print_nav_menu_item($post, 'menu', $items_counter);104 echo wp_get_nav_menu_item( $post, 'menu', $items_counter ); 50 105 $parentli = $post->ID; 51 106 $items_counter++; 52 $items_counter = wp_ custom_navigation_default_sub_items($post->ID, $items_counter, $parentli, 'pages', 'menu');107 $items_counter = wp_nav_menu_sub_items( $post->ID, $items_counter, $parentli, 'pages', 'menu' ); 53 108 ?> 54 109 </li> 55 56 110 <?php 57 } elseif ( $ type== 'default' ) {111 } elseif ( $context == 'default' ) { 58 112 // Sidebar Menu 59 113 ?> 60 114 <li> 61 115 <?php 62 wp_print_nav_menu_item($post, 'default');116 echo wp_get_nav_menu_item( $post, 'default' ); 63 117 $parentli = $post->ID; 64 118 $items_counter++; 65 $items_counter = wp_nav_menu_sub_items( $post->ID, $items_counter, $parentli, 'pages', 'default');119 $items_counter = wp_nav_menu_sub_items( $post->ID, $items_counter, $parentli, 'pages', 'default' ); 66 120 ?> 67 121 </li> 68 69 122 <?php 70 123 } 71 124 } 72 125 } 73 74 126 return $items_counter; 75 127 } 76 128 77 // Outputs All Categories and Sub Items 78 function wp_nav_menu_get_categories($counter, $type) { 79 129 /** 130 * Displays a list of categories and thier sub items. 131 * 132 * @since 3.0.0 133 * 134 * @param string $counter 135 * @param string $context 136 */ 137 function wp_nav_menu_get_categories( $counter, $context ) { 80 138 $category_args = array( 81 139 'type' => 'post', 82 140 'child_of' => 0, … … 93 151 $items_counter = $counter; 94 152 95 153 // Get all categories 96 $categories_array = get_categories( $category_args);154 $categories_array = get_categories( $category_args ); 97 155 98 156 if ( !$categories_array ) { 99 157 _e('Not Found'); … … 103 161 // Display Loop 104 162 foreach ( $categories_array as $cat_item ) { 105 163 if ( $cat_item->parent == 0 ) { 106 $cat_item = wp_setup_nav_menu_item( $cat_item, 'category', $items_counter);164 $cat_item = wp_setup_nav_menu_item( $cat_item, 'category', $items_counter ); 107 165 // Custom Menu 108 if ( $ type== 'menu' ) {166 if ( $context == 'menu' ) { 109 167 ?> 110 111 168 <li id="menu-<?php echo $items_counter; ?>" value="<?php echo $items_counter; ?>"> 112 169 <?php 113 wp_print_nav_menu_item($cat_item, 'menu');170 echo wp_get_nav_menu_item($cat_item, 'menu'); 114 171 $parentli = $cat_item->cat_ID; 115 172 $items_counter++; 116 $items_counter = wp_nav_menu_sub_items( $cat_item->cat_ID, $items_counter, $parentli, 'categories', 'menu');173 $items_counter = wp_nav_menu_sub_items( $cat_item->cat_ID, $items_counter, $parentli, 'categories', 'menu' ); 117 174 ?> 118 119 175 </li> 120 121 176 <?php 122 } elseif ( $ type== 'default' ) {177 } elseif ( $context == 'default' ) { 123 178 // Sidebar Menu 124 179 ?> 125 180 <li> 126 181 <?php 127 wp_print_nav_menu_item($cat_item, 'default');182 echo wp_get_nav_menu_item( $cat_item, 'default' ); 128 183 $parentli = $cat_item->cat_ID; 129 184 $items_counter++; 130 $items_counter = wp_nav_menu_sub_items( $cat_item->cat_ID, $items_counter, $parentli, 'categories', 'default');185 $items_counter = wp_nav_menu_sub_items( $cat_item->cat_ID, $items_counter, $parentli, 'categories', 'default' ); 131 186 ?> 132 133 187 </li> 134 135 188 <?php 136 189 } 137 190 } 138 191 } 139 140 192 return $items_counter; 141 193 } 142 194 143 //RECURSIVE Sub Menu Items of default categories and pages 144 function wp_nav_menu_sub_items($childof, $items_counter, $parentli, $type, $output_type) { 145 195 /** 196 * Recursive function that gets sub menu items. 197 * 198 * @since 3.0.0 199 * 200 * @param string $childof 201 * @param string $items_counter 202 * @param string $parentli 203 * @param string $context 204 * @param string $output_type 205 */ 206 function wp_nav_menu_sub_items( $childof, $items_counter, $parentli, $context, $output_type ) { 146 207 $counter = $items_counter; 147 208 148 209 // Custom Menu … … 159 220 'parent' => $childof); 160 221 } 161 222 162 if ( $ type== 'categories' ) {223 if ( $context == 'categories' ) { 163 224 // Get Sub Category Items 164 225 $item_type = 'category'; 165 226 $sub_array = get_categories($sub_args); 166 } elseif ($ type== 'pages') {227 } elseif ($context == 'pages') { 167 228 // Get Sub Page Items 168 229 $item_type = 'page'; 169 230 $sub_array = get_pages($sub_args); … … 172 233 $sub_array = array(); 173 234 } 174 235 175 176 236 if ( $sub_array ) { 177 237 ?> 178 <ul id="sub-menu-<?php echo $type ?>"> 179 238 <ul id="sub-menu-<?php echo $context ?>"> 180 239 <?php 181 240 // Display Loop 182 241 foreach ( $sub_array as $sub_item ) { 183 $sub_item = wp_setup_nav_menu_item($sub_item, $item_type, $counter); 184 242 $sub_item = wp_setup_nav_menu_item( $sub_item, $item_type, $counter ); 185 243 if ( $output_type == 'menu' ) { 186 244 ?> 187 245 <li id="menu-<?php echo $counter; ?>" value="<?php echo $counter; ?>"> 188 246 <?php 189 wp_print_nav_menu_item($sub_item, 'menu');247 echo wp_get_nav_menu_item( $sub_item, 'menu' ); 190 248 $counter++; 191 $counter = wp_nav_menu_sub_items( $sub_item->ID, $counter, $sub_item->ID, $type, 'menu');249 $counter = wp_nav_menu_sub_items( $sub_item->ID, $counter, $sub_item->ID, $context, 'menu' ); 192 250 ?> 193 194 251 </li> 195 252 <?php 196 253 } elseif ( $output_type == 'default' ) { … … 198 255 ?> 199 256 <li> 200 257 <?php 201 wp_print_nav_menu_item($sub_item, 'default');258 echo wp_get_nav_menu_item( $sub_item, 'default' ); 202 259 //$counter++; 203 $counter = wp_nav_menu_sub_items( $sub_item->ID, $counter, $sub_item->ID, $type, 'default');260 $counter = wp_nav_menu_sub_items( $sub_item->ID, $counter, $sub_item->ID, $context, 'default' ); 204 261 ?> 205 262 </li> 206 263 … … 208 265 } 209 266 } 210 267 ?> 211 212 268 </ul> 213 214 269 <?php 215 270 } 216 217 271 return $counter; 218 272 } 219 /*220 function wp_nav_menu_setup($override = false) {221 // Custom Navigation Menu Setup222 223 // Override for menu descriptions224 update_option('wp_settings_nav_menu_advanced_options', 'yes');225 226 $menus = wp_get_nav_menus();227 if ( !empty( $menus ) ) {228 foreach ( $menus as $menu ) {229 wp_delete_nav_menu( $menu->term_id );230 }231 }232 233 wp_create_nav_menu( __('Main') );234 }235 /**/236 273 ?> 237 No newline at end of file -
wp-admin/js/nav-menu-default-items.dev.js
13 13 */ 14 14 jQuery(document).ready(function($){ 15 15 16 wp_drag_and_drop(); 17 18 wp_update_post_data(); 19 16 20 // Handle Save Button Clicks 17 21 $('#save_menu').click(function(){ 18 wp_update_post_data();22 return wp_update_post_data(); 19 23 }); 20 24 21 25 // Clear the quick search textbox … … 30 34 31 35 // Edit menu item 32 36 $('#menu-container .item-edit').click(function(){ 33 wp_edit_menu_item( $(this).attr('value') );37 return wp_edit_menu_item( $(this).attr('value') ); 34 38 }); 35 39 36 40 // Delete menu item 37 41 $('#menu-container .item-delete').live( 'click', function(){ 38 wp_remove_menu_item( $(this).attr('value') );42 return wp_remove_menu_item( $(this).attr('value') ); 39 43 }); 40 44 41 45 // Update menu item settings (thickbox) … … 50 54 51 55 // Close thickbox 52 56 $('#cancel-save').click(function(){ 53 tb_remove();57 return tb_remove(); 54 58 }); 55 59 56 60 // Show All Button … … 58 62 $(this).offsetParent().find('#add-buttons-actions').attr( 'style','margin-bottom: 10px;' ); 59 63 $(this).offsetParent().find('.list-wrap').css( 'display','block' ); 60 64 $(this).siblings('.quick-search').attr( 'value', '' ); 61 $(this).offsetParent().find('.list-wrap dt').css( 'display', 'block' );65 $(this).offsetParent().find('.list-wrap li').css( 'display', 'block' ); 62 66 $(this).hide(); 63 67 $(this).siblings('.hide-all').show(); 64 68 }); … … 68 72 $(this).offsetParent().find('#add-buttons-actions').attr( 'style','margin-bottom: 0px;' ); 69 73 $(this).offsetParent().find('.list-wrap').css( 'display','none' ); 70 74 $(this).siblings('.quick-search').attr( 'value', 'Search' ); 71 $(this).offsetParent().find('.list-wrap dt').css( 'display', 'none' );75 $(this).offsetParent().find('.list-wrap li').css( 'display', 'none' ); 72 76 $(this).hide(); 73 77 $(this).siblings('.show-all').show(); 74 78 }); 75 79 80 // Add menu item to queue 81 $('.list input').click(function(){ 82 83 var item_type = jQuery(this).parent().siblings('.item-type').val(); 84 var item_title = jQuery(this).parent().siblings('.item-title').val(); 85 var item_url = jQuery(this).parent().siblings('.item-url').val(); 86 var item_id = jQuery(this).parent().siblings('.item-id').val(); 87 var item_parent_id = jQuery(this).parent().siblings('.item-parent-id').val(); 88 var item_description = jQuery(this).parent().siblings('.item-description').val(); 89 90 return wp_update_queue( $(this), item_type, item_title, item_url, item_id, item_parent_id, item_description ); 91 }); 92 76 93 // Add queued menu items into the menu 77 94 $('.enqueue a').click(function(){ 78 wp_add_queued_items_to_menu(this);95 return wp_add_queued_items_to_menu(this); 79 96 }); 80 97 81 98 // Create the link, add it to the menu + available links section 82 99 $('#add-custom-link .add-to-menu a').click(function(){ 83 100 var link_url = $(this).offsetParent().find('#menu-item-url').val(); 84 101 var link_name = $(this).offsetParent().find('#menu-item-name').val(); 85 var links = $(this).offsetParent().find('#available-links input:checked');86 102 87 // If links are checked in the available links section, add them to the menu 88 if ( links ) { 89 for (var i = 0; i < links.length; i++) { 90 wp_add_item_to_menu( 'Custom', links[i].name, links[i].value, links[i].id.substring( 5, links[i].id.length ), 0, '' ); 91 }; 92 93 // Reset the checkboxes; 94 $(links).attr('checked', false); 95 }; 103 wp_add_queued_items_to_menu( this ); 96 104 97 105 // Don't save the link if it was left with it's default settings 98 106 if ( 'http://' == link_url || 'Menu Item' == link_name ) … … 119 127 wp_add_item_to_menu( 'Custom', params.link_name, params.link_url, params.link_id, 0, '' ); 120 128 }, 'json'); 121 129 }); 122 123 // Add dropzones124 $('#menu li').prepend('<div class="dropzone"></div>');125 126 // Make menu items draggable127 $('#menu li').draggable({128 handle: ' > dl',129 opacity: .8,130 addClasses: false,131 helper: 'clone',132 zIndex: 100133 });134 135 // Make items droppable136 $('#menu dl, #menu .dropzone').droppable({137 accept: '#menu li',138 tolerance: 'pointer',139 140 drop: function(e, ui) {141 var li = $(this).parent();142 var child = !$(this).hasClass('dropzone');143 144 // Add UL to first child145 if ( child && li.children('ul').length == 0 ) {146 li.append('<ul id="sub-menu" />');147 }148 // Make it draggable149 if ( child ) {150 li.children('ul').append( ui.draggable );151 } else {152 li.before( ui.draggable );153 }154 155 li.find('dl,.dropzone').css({ backgroundColor: '', borderColor: '' });156 157 var draggablevalue = ui.draggable.attr('value');158 var droppablevalue = li.attr('value');159 160 li.find('#menu-' + draggablevalue).find('#parent' + draggablevalue).val(droppablevalue);161 $(this).parent().find('dt').removeAttr('style');162 163 $(this).parent().find('div:first').removeAttr('style');164 },165 166 over: function() {167 168 if ( 'dropzone ui-droppable' == $(this).attr('class') ) {169 // Add child170 $(this).parent().find('dt:first').css('background', 'none').css('height', '50px');171 172 } else if ($(this).attr('class') == 'ui-droppable') {173 // Add above174 $(this).parent().find('dt:first').css('background', '#d8d8d8');175 176 } else {177 // do nothing178 }179 var parentid = $(this).parent().attr('id');180 },181 out: function() {182 $(this).parent().find('dt').removeAttr('style');183 $(this).parent().find('div:first').removeAttr('style');184 $(this).filter('.dropzone').css({ borderColor: '' });185 },186 deactivate: function() {187 //188 }189 });190 130 }); 191 No newline at end of file -
wp-admin/js/nav-menu-dynamic-functions.js
1 function wp_update_links_list(e){var link='<li><dl><dt><label class="item-title"><input type="checkbox" id="link-'+e.link_id+'" name="'+e.link_name+'" value="'+e.link_url+'" />'+e.link_name+"</label></dt></dl></li>";jQuery("#available-links .list").prepend(link);jQuery("#available-links .list #link-"+e.link_id).parent().animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){jQuery(this).css("backgroundColor","")}})}function wp_ remove_menu_item(o){var todelete=document.getElementById("menu-"+o);if(todelete){jQuery(todelete).find("dt").each(function(){jQuery(this).animate({backgroundColor:"#FF3333"},{duration:"normal",complete:function(){jQuery(this).parent().parent().remove()}})});wp_update_post_data()}}function wp_edit_menu_item(id){console.log("wp_edit_menu_item");var itemTitle=jQuery("#item-title"+id).val();var itemURL=jQuery("#item-url"+id).val();var itemAttrTitle=jQuery("#item-attr-title"+id).val();var itemTarget=jQuery("#item-target"+id).val();var itemDesc=jQuery("#item-description"+id).val();console.log(id);console.log(itemTitle);console.log(itemURL);console.log(itemAttrTitle);console.log(itemTarget);console.log(itemDesc);jQuery("#edit-item-id").val(id);jQuery("#edit-item-title").val(itemTitle);jQuery("#edit-item-url").val(itemURL);jQuery("#edit-item-attr-title").val(itemAttrTitle);jQuery("#edit-item-target").val(itemTarget);jQuery("#edit-item-target option[value='"+itemTarget+"']").attr("selected","selected");jQuery("#edit-item-description").val(itemDesc)}function wp_update_menu_item(){var id=jQuery("#edit-item-id").val();var itemTitle=jQuery("#edit-item-title").val();var itemURL=jQuery("#edit-item-url").val();var itemAttrTitle=jQuery("#edit-item-attr-title").val();var itemTarget=jQuery("#edit-item-target").val();var itemDesc=jQuery("#edit-item-description").val();console.log(id);console.log(itemTitle);console.log(itemURL);console.log(itemAttrTitle);console.log(itemTarget);console.log(itemDesc);jQuery("#menu-"+id).find(".item-title:first").html(itemTitle);jQuery("#item-title"+id).val(itemTitle);jQuery("#item-url"+id).val(itemURL);jQuery("#item-attr-title"+id).val(itemAttrTitle);jQuery("#item-target"+id).val(itemTarget);jQuery("#item-description"+id).val(itemDesc)}function wp_update_post_data(){var i=0;jQuery("#menu li").each(function(i){i=i+1;var j=jQuery(this).attr("value");jQuery(this).find("#position"+j).attr("value",i);jQuery(this).attr("id","menu-"+i);jQuery(this).attr("value",i);jQuery(this).find("#dbid"+j).attr("name","dbid"+i);jQuery(this).find("#dbid"+j).attr("id","dbid"+i);jQuery(this).find("#postmenu"+j).attr("name","postmenu"+i);jQuery(this).find("#postmenu"+j).attr("id","postmenu"+i);var p=jQuery(this).find("#parent"+j).parent().parent().parent().attr("value");jQuery(this).find("#parent"+j).attr("name","parent"+i);jQuery(this).find("#parent"+j).attr("id","parent"+i);if(p){}else{p=0}jQuery(this).find("#parent"+j).attr("value",p);jQuery(this).find("#item-title"+j).attr("name","item-title"+i);jQuery(this).find("#item-title"+j).attr("id","item-title"+i);jQuery(this).find("#item-url"+j).attr("name","item-url"+i);jQuery(this).find("#item-url"+j).attr("id","item-url"+i);jQuery(this).find("#item-description"+j).attr("name","item-description"+i);jQuery(this).find("#item-description"+j).attr("id","item-description"+i);jQuery(this).find("#item-attr-title"+j).attr("name","item-attr-title"+i);jQuery(this).find("#item-attr-title"+j).attr("id","item-attr-title"+i);jQuery(this).find("#item-target"+j).attr("name","item-target"+i);jQuery(this).find("#item-target"+j).attr("id","item-target"+i);jQuery(this).find("#position"+j).attr("name","position"+i);jQuery(this).find("#position"+j).attr("id","position"+i);jQuery(this).find("#linktype"+j).attr("name","linktype"+i);jQuery(this).find("#linktype"+j).attr("id","linktype"+i);jQuery("#li-count").attr("value",i)})}function wp_add_item_to_menu(additemtype,itemtext,itemurl,itemid,itemparentid,itemdescription){var inputvaluevarname="";var inputvaluevarurl="";var inputitemid="";var inputparentid="";var inputdescription="";var randomnumber=wp_get_unique_menu_id();inputvaluevarname=htmlentities(itemtext.toString());inputvaluevarurl=itemurl.toString();inputitemid=itemid;inputparentid=itemparentid;inputlinktype="custom";inputdescription=htmlentities(itemdescription.toString());jQuery("#menu").append('<li id="menu-'+randomnumber+'" value="'+randomnumber+'"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="item-title">'+inputvaluevarname+'</span><span class="item-controls"><span class="item-type">'+additemtype+'</span><a class="item-edit thickbox" id="edit'+randomnumber+'" value="'+randomnumber+'" onClick="wp_edit_menu_item('+randomnumber+')" title="'+navMenuL10n.thickbox+'" href="#TB_inline?height=380&width=300&inlineId=menu-item-settings">'+navMenuL10n.edit+'</a> | <a class="item-delete" id="delete'+randomnumber+'" value="'+randomnumber+'">Delete</a></span></dt></dl><a class="hide" href="'+inputvaluevarurl+'">'+inputvaluevarname+'</a><input type="hidden" name="postmenu'+randomnumber+'" id="postmenu'+randomnumber+'" value="'+inputitemid+'" /><input type="hidden" name="parent'+randomnumber+'" id="parent'+randomnumber+'" value="'+inputparentid+'" /><input type="hidden" name="item-title'+randomnumber+'" id="item-title'+randomnumber+'" value="'+inputvaluevarname+'" /><input type="hidden" name="item-url'+randomnumber+'" id="item-url'+randomnumber+'" value="'+inputvaluevarurl+'" /><input type="hidden" name="item-description'+randomnumber+'" id="item-description'+randomnumber+'" value="'+inputdescription+'" /><input type="hidden" name="position'+randomnumber+'" id="position'+randomnumber+'" value="'+randomnumber+'" /><input type="hidden" name="linktype'+randomnumber+'" id="linktype'+randomnumber+'" value="'+inputlinktype+'" /><input type="hidden" name="item-attr-title'+randomnumber+'" id="item-attr-title'+randomnumber+'" value="'+inputvaluevarname+'" /><input type="hidden" name="item-target'+randomnumber+'" id="item-target'+randomnumber+'" value="0" /></li>');jQuery("#menu #menu-"+randomnumber+" dt:first").animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){jQuery(this).css("backgroundColor","")}});wp_drag_and_drop();tb_init("a.thickbox, area.thickbox, input.thickbox")}function wp_update_queue(additemtype,itemtext,itemurl,itemid,itemparentid,itemdescription){var inputvaluevarname="";var inputvaluevarurl="";var inputitemid="";var inputparentid="";var inputdescription="";var randomnumber=wp_get_unique_menu_id();if(additemtype==navMenuL10n.page){inputvaluevarname=htmlentities(itemtext.toString());inputvaluevarurl=itemurl.toString();inputitemid=itemid.toString();inputparentid="0";inputlinktype="page";inputdescription=htmlentities(itemdescription.toString())}else{if(additemtype==navMenuL10n.category){inputvaluevarname=htmlentities(itemtext.toString());inputvaluevarurl=itemurl.toString();inputitemid=itemid.toString();inputparentid="0";inputlinktype="category";inputdescription=htmlentities(itemdescription.toString())}}if(jQuery(menu_item_id="#menu-item-"+inputitemid).attr("checked")){jQuery("#queue").append('<li id="menu-'+randomnumber+'" value="'+randomnumber+'"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="item-title">'+inputvaluevarname+'</span><span class="item-controls"><span class="item-type">'+additemtype+'</span><a class="item-edit thickbox" id="edit'+randomnumber+'" value="'+randomnumber+'" onClick="wp_edit_menu_item('+randomnumber+')" title="'+navMenuL10n.thickbox+'" href="#TB_inline?height=380&width=300&inlineId=menu-item-settings">'+navMenuL10n.edit+'</a> | <a class="item-delete" id="delete'+randomnumber+'" value="'+randomnumber+'">Delete</a></span></dt></dl><a class="hide" href="'+inputvaluevarurl+'">'+inputvaluevarname+'</a><input type="hidden" name="postmenu'+randomnumber+'" id="postmenu'+randomnumber+'" value="'+inputitemid+'" /><input type="hidden" name="parent'+randomnumber+'" id="parent'+randomnumber+'" value="'+inputparentid+'" /><input type="hidden" name="item-title'+randomnumber+'" id="item-title'+randomnumber+'" value="'+inputvaluevarname+'" /><input type="hidden" name="item-url'+randomnumber+'" id="item-url'+randomnumber+'" value="'+inputvaluevarurl+'" /><input type="hidden" name="item-description'+randomnumber+'" id="item-description'+randomnumber+'" value="'+inputdescription+'" /><input type="hidden" name="position'+randomnumber+'" id="position'+randomnumber+'" value="'+randomnumber+'" /><input type="hidden" name="linktype'+randomnumber+'" id="linktype'+randomnumber+'" value="'+inputlinktype+'" /><input type="hidden" name="item-attr-title'+randomnumber+'" id="item-attr-title'+randomnumber+'" value="'+inputvaluevarname+'" /><input type="hidden" name="item-target'+randomnumber+'" id="item-target'+randomnumber+'" value="0" /></li>')}else{for(var i=0;i<jQuery('#queue li input[name^="postmenu"]').length;i++){if(itemid==jQuery('#queue li input[name^="postmenu"]')[i].value){var menu_queue_id=jQuery('#queue li input[name^="postmenu"]')[i].name.substring(8,jQuery('#queue li input[name^="postmenu"]')[i].name.length)}}jQuery("#queue li#menu-"+menu_queue_id).remove()}}function wp_add_queued_items_to_menu(button){var items=jQuery("#queue").children();jQuery("#queue").empty();jQuery("#menu").append(items);jQuery(items).each(function(){jQuery(this).find("dt").animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){jQuery(this).css("backgroundColor","")}})});jQuery(button).offsetParent().find(".list-container input").attr("checked",false);wp_update_post_data();wp_drag_and_drop();tb_init("a.thickbox, area.thickbox, input.thickbox")}function wp_drag_and_drop(){jQuery("#menu li").draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100});jQuery("#menu li dl, #menu li .dropzone").droppable({accept:"#menu li",tolerance:"pointer",drop:function(e,ui){var li=jQuery(this).parent();var child=!jQuery(this).hasClass("dropzone");if(child&&li.children("ul").length==0){li.append("<ul/>")}if(child){li.children("ul").append(ui.draggable)}else{li.before(ui.draggable)}li.find("dl,.dropzone").css({backgroundColor:"",borderColor:""});var draggablevalue=ui.draggable.attr("value");var droppablevalue=li.attr("value");li.find("#menu-"+draggablevalue).find("#parent"+draggablevalue).val(droppablevalue);jQuery(this).parent().find("dt").removeAttr("style");jQuery(this).parent().find("div:first").removeAttr("style")},over:function(){if(jQuery(this).attr("class")=="dropzone ui-droppable"){jQuery(this).parent().find("div:first").css("background","none").css("height","50px")}else{if(jQuery(this).attr("class")=="ui-droppable"){jQuery(this).parent().find("dt:first").css("background","#d8d8d8")}else{}}var parentid=jQuery(this).parent().attr("id")},out:function(){jQuery(this).parent().find("dt").removeAttr("style");jQuery(this).parent().find("div:first").removeAttr("style");jQuery(this).filter(".dropzone").css({borderColor:""})}})}function wp_get_unique_menu_id(){var count=document.getElementById("menu").getElementsByTagName("li").length+1;var randomnumber=count;var validatetest=0;try{var test=document.getElementById("menu-"+randomnumber.toString()).value}catch(err){validatetest=1}while(validatetest==0){randomnumber=randomnumber+1;try{var test2=document.getElementById("menu-"+randomnumber.toString()).value}catch(err){validatetest=1}}return randomnumber};2 No newline at end of file 1 function wp_update_links_list(e){var link='<li><dl><dt><label class="item-title"><input type="checkbox" id="link-'+e.link_id+'" name="'+e.link_name+'" value="'+e.link_url+'" />'+e.link_name+"</label></dt></dl></li>";jQuery("#available-links .list").prepend(link);jQuery("#available-links .list #link-"+e.link_id).parent().animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){jQuery(this).css("backgroundColor","")}})}function wp_edit_menu_item(id){var itemType=jQuery("#item-type"+id).val();var itemTitle=jQuery("#item-title"+id).val();var itemURL=jQuery("#item-url"+id).val();var itemAttrTitle=jQuery("#item-attr-title"+id).val();var itemTarget=jQuery("#item-target"+id).val();var itemDesc=jQuery("#item-description"+id).val();if("page"==itemType||"category"==itemType){jQuery("#edit-item-url").attr("disabled","disabled")}jQuery("#edit-item-id").val(id);jQuery("#edit-item-title").val(itemTitle);jQuery("#edit-item-url").val(itemURL);jQuery("#edit-item-attr-title").val(itemAttrTitle);jQuery("#edit-item-target").val(itemTarget);jQuery("#edit-item-target option[value='"+itemTarget+"']").attr("selected","selected");jQuery("#edit-item-description").val(itemDesc)}function wp_update_menu_item(){var id=jQuery("#edit-item-id").val();var itemTitle=jQuery("#edit-item-title").val();var itemURL=jQuery("#edit-item-url").val();var itemAttrTitle=jQuery("#edit-item-attr-title").val();var itemTarget=jQuery("#edit-item-target").val();var itemDesc=jQuery("#edit-item-description").val();jQuery("#menu-"+id).find(".item-title:first").html(itemTitle);jQuery("#item-title"+id).val(itemTitle);jQuery("#item-url"+id).val(itemURL);jQuery("#item-attr-title"+id).val(itemAttrTitle);jQuery("#item-target"+id).val(itemTarget);jQuery("#item-description"+id).val(itemDesc)}function wp_remove_menu_item(o){var todelete=document.getElementById("menu-"+o);if(todelete){jQuery(todelete).find("dt").each(function(){jQuery(this).animate({backgroundColor:"#FF3333"},{duration:"normal",complete:function(){jQuery(this).parent().parent().remove()}})});wp_update_post_data()}}function wp_update_post_data(){var i=0;jQuery(".menu li").each(function(i){i=i+1;var j=jQuery(this).attr("value");jQuery(this).find("#item-position"+j).attr("value",i);jQuery(this).attr("id","menu-"+i);jQuery(this).attr("value",i);jQuery(this).find("#item-dbid"+j).attr("name","item-dbid"+i);jQuery(this).find("#item-dbid"+j).attr("id","item-dbid"+i);jQuery(this).find("#item-postmenu"+j).attr("name","item-postmenu"+i);jQuery(this).find("#item-postmenu"+j).attr("id","item-postmenu"+i);var p=jQuery(this).find("#item-parent"+j).parent().parent().parent().attr("value");jQuery(this).find("#item-parent"+j).attr("name","item-parent"+i);jQuery(this).find("#item-parent"+j).attr("id","item-parent"+i);if(p){}else{p=0}jQuery(this).find("#item-parent"+j).attr("value",p);jQuery(this).find("#item-title"+j).attr("name","item-title"+i);jQuery(this).find("#item-title"+j).attr("id","item-title"+i);jQuery(this).find("#item-url"+j).attr("name","item-url"+i);jQuery(this).find("#item-url"+j).attr("id","item-url"+i);jQuery(this).find("#item-description"+j).attr("name","item-description"+i);jQuery(this).find("#item-description"+j).attr("id","item-description"+i);jQuery(this).find("#item-attr-title"+j).attr("name","item-attr-title"+i);jQuery(this).find("#item-attr-title"+j).attr("id","item-attr-title"+i);jQuery(this).find("#item-target"+j).attr("name","item-target"+i);jQuery(this).find("#item-target"+j).attr("id","item-target"+i);jQuery(this).find("#item-position"+j).attr("name","item-position"+i);jQuery(this).find("#item-position"+j).attr("id","item-position"+i);jQuery(this).find("#item-type"+j).attr("name","item-type"+i);jQuery(this).find("#item-type"+j).attr("id","item-type"+i);jQuery("#li-count").attr("value",i)})}function wp_add_item_to_menu(item_type,item_title,item_url,item_id,item_parent_id,item_description){var randomnumber=wp_get_unique_menu_id();jQuery(".menu").append('<li id="menu-'+randomnumber+'" value="'+randomnumber+'"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="item-title">'+item_title+'</span><span class="item-controls"><span class="item-type">'+item_type+'</span><a class="item-edit thickbox" id="edit'+randomnumber+'" value="'+randomnumber+'" onClick="wp_edit_menu_item('+randomnumber+')" title="'+navMenuL10n.thickbox+'" href="#TB_inline?height=380&width=300&inlineId=menu-item-settings">'+navMenuL10n.edit+'</a> | <a class="item-delete" id="delete'+randomnumber+'" value="'+randomnumber+'">Delete</a></span></dt></dl><input type="hidden" name="item-postmenu'+randomnumber+'" id="item-postmenu'+randomnumber+'" value="'+item_id+'" /><input type="hidden" name="item-parent'+randomnumber+'" id="item-parent'+randomnumber+'" value="'+item_parent_id+'" /><input type="hidden" name="item-title'+randomnumber+'" id="item-title'+randomnumber+'" value="'+item_title+'" /><input type="hidden" name="item-url'+randomnumber+'" id="item-url'+randomnumber+'" value="'+item_url+'" /><input type="hidden" name="item-description'+randomnumber+'" id="item-description'+randomnumber+'" value="'+item_description+'" /><input type="hidden" name="item-position'+randomnumber+'" id="item-position'+randomnumber+'" value="'+randomnumber+'" /><input type="hidden" name="item-type'+randomnumber+'" id="item-type'+randomnumber+'" value="'+item_type+'" /><input type="hidden" name="item-attr-title'+randomnumber+'" id="item-attr-title'+randomnumber+'" value="'+item_title+'" /><input type="hidden" name="item-target'+randomnumber+'" id="item-target'+randomnumber+'" value="0" /></li>');jQuery(".menu #menu-"+randomnumber+" dt:first").animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){jQuery(this).css("backgroundColor","")}});wp_drag_and_drop();wp_update_post_data();tb_init("a.thickbox, area.thickbox, input.thickbox")}function wp_update_queue(e,item_type,item_title,item_url,item_id,item_parent_id,item_description){var randomnumber=wp_get_unique_menu_id();var menu_item_id=jQuery(e).attr("id");if(jQuery(e).attr("checked")){jQuery("#queue").append('<li id="menu-'+randomnumber+'" value="'+randomnumber+'"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="item-title">'+item_title+'</span><span class="item-controls"><span class="item-type">'+item_type+'</span><a class="item-edit thickbox" id="edit'+randomnumber+'" value="'+randomnumber+'" onClick="wp_edit_menu_item('+randomnumber+')" title="'+navMenuL10n.thickbox+'" href="#TB_inline?height=380&width=300&inlineId=menu-item-settings">'+navMenuL10n.edit+'</a> | <a class="item-delete" id="delete'+randomnumber+'" value="'+randomnumber+'">Delete</a></span></dt></dl><input type="hidden" name="item-postmenu'+randomnumber+'" id="item-postmenu'+randomnumber+'" value="'+item_id+'" /><input type="hidden" name="item-parent'+randomnumber+'" id="item-parent'+randomnumber+'" value="'+item_parent_id+'" /><input type="hidden" name="item-title'+randomnumber+'" id="item-title'+randomnumber+'" value="'+item_title+'" /><input type="hidden" name="item-url'+randomnumber+'" id="item-url'+randomnumber+'" value="'+item_url+'" /><input type="hidden" name="item-description'+randomnumber+'" id="item-description'+randomnumber+'" value="'+item_description+'" /><input type="hidden" name="item-position'+randomnumber+'" id="item-position'+randomnumber+'" value="'+randomnumber+'" /><input type="hidden" name="item-type'+randomnumber+'" id="item-type'+randomnumber+'" value="'+item_type+'" /><input type="hidden" name="item-attr-title'+randomnumber+'" id="item-attr-title'+randomnumber+'" value="'+item_title+'" /><input type="hidden" name="item-target'+randomnumber+'" id="item-target'+randomnumber+'" value="0" /><input type="hidden" name="item-id'+randomnumber+'" id="item-id'+randomnumber+'" value="'+menu_item_id+'" /></li>')}else{if(menu_item_id==jQuery('#queue li input[name^="item-id"]').val()){jQuery('#queue li input[name^="item-id"]').parent().remove()}}}function wp_add_queued_items_to_menu(button){var items=jQuery("#queue").children();jQuery("#queue").empty();jQuery(".menu").append(items);jQuery(items).each(function(){jQuery(this).find("dt").animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){jQuery(this).css("backgroundColor","")}})});jQuery(button).offsetParent().find(".list-container input").attr("checked",false);wp_update_post_data();wp_drag_and_drop();tb_init("a.thickbox, area.thickbox, input.thickbox")}function wp_drag_and_drop(){jQuery(".menu li").each(function(){if(!jQuery(this).children(".dropzone").attr("class")){jQuery(this).prepend('<div class="dropzone"></div>')}});jQuery(".menu li").draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100,});jQuery(".menu li dl, .menu li .dropzone").droppable({accept:".menu li",tolerance:"pointer",drop:function(e,ui){var li=jQuery(this).parent();var child=!jQuery(this).hasClass("dropzone");if(child&&li.children("ul").length==0){li.append('<ul class="sub-menu" />')}if(child){li.children("ul").append(ui.draggable)}else{li.before(ui.draggable)}li.find("dl,.dropzone").css({backgroundColor:"",borderColor:""});var draggablevalue=ui.draggable.attr("value");var droppablevalue=li.attr("value");li.find("#menu-"+draggablevalue).find("#parent"+draggablevalue).val(droppablevalue);jQuery(this).parent().find("dt").removeAttr("style");jQuery(this).parent().find("div:first").removeAttr("style")},over:function(){if(jQuery(this).attr("class")=="dropzone ui-droppable"){jQuery(this).parent().find("div:first").css("background","none").css("height","50px")}else{if(jQuery(this).attr("class")=="ui-droppable"){jQuery(this).parent().find("dt:first").css("background","#d8d8d8")}else{}}var parentid=jQuery(this).parent().attr("id")},out:function(){jQuery(this).parent().find("dt").removeAttr("style");jQuery(this).parent().find("div:first").removeAttr("style");jQuery(this).filter(".dropzone").css({borderColor:""})}})}function wp_get_unique_menu_id(){var count=jQuery(".menu li").length+1;var randomnumber=count;var validatetest=0;try{var test=document.getElementById("menu-"+randomnumber.toString()).value}catch(err){validatetest=1}while(validatetest==0){randomnumber=randomnumber+1;try{var test2=document.getElementById("menu-"+randomnumber.toString()).value}catch(err){validatetest=1}}return randomnumber}; 2 No newline at end of file -
wp-admin/js/nav-menu-dynamic-functions.dev.js
24 24 } 25 25 26 26 /** 27 * Removes a menu item from current menu28 *29 * @param int o - the id of the menu li to remove.30 */31 function wp_remove_menu_item( o ) {32 var todelete = document.getElementById('menu-' + o);33 34 if ( todelete ) {35 // Give some feedback to the user36 jQuery( todelete ).find('dt').each(function(){37 jQuery(this).animate( { backgroundColor: '#FF3333' }, { duration: 'normal', complete: function() { jQuery(this).parent().parent().remove() } } );38 });39 40 wp_update_post_data();41 }42 };43 44 /**45 27 * Populate the thickbox window with the selected menu items 46 28 * 47 29 * @param int o - the id of the menu li to edit. 48 30 */ 49 31 function wp_edit_menu_item( id ) { 50 console.log('wp_edit_menu_item'); 51 32 var itemType = jQuery('#item-type' + id).val(); 52 33 var itemTitle = jQuery('#item-title' + id).val(); 53 34 var itemURL = jQuery('#item-url' + id).val(); 54 35 var itemAttrTitle = jQuery('#item-attr-title' + id).val(); 55 36 var itemTarget = jQuery('#item-target' + id).val(); 56 37 var itemDesc = jQuery('#item-description' + id).val(); 57 38 58 console.log(id); 59 console.log(itemTitle); 60 console.log(itemURL); 61 console.log(itemAttrTitle); 62 console.log(itemTarget); 63 console.log(itemDesc); 39 // Disable the ability to edit the url for page and category items 40 if ( 'page' == itemType || 'category' == itemType ) 41 jQuery( '#edit-item-url' ).attr('disabled', 'disabled' ); 64 42 65 43 // Populate the fields for thickbox 66 44 jQuery( '#edit-item-id' ).val(id); … … 83 61 var itemTarget = jQuery('#edit-item-target').val(); 84 62 var itemDesc = jQuery('#edit-item-description').val(); 85 63 86 console.log(id);87 console.log(itemTitle);88 console.log(itemURL);89 console.log(itemAttrTitle);90 console.log(itemTarget);91 console.log(itemDesc);92 93 64 // update menu item settings 94 65 jQuery('#menu-' + id).find('.item-title:first').html(itemTitle); 95 66 jQuery('#item-title' + id).val(itemTitle); … … 100 71 } 101 72 102 73 /** 74 * Removes a menu item from current menu 75 * 76 * @param int o - the id of the menu li to remove. 77 */ 78 function wp_remove_menu_item( o ) { 79 var todelete = document.getElementById('menu-' + o); 80 81 if ( todelete ) { 82 // Give some feedback to the user 83 jQuery( todelete ).find('dt').each(function(){ 84 jQuery(this).animate( { backgroundColor: '#FF3333' }, { duration: 'normal', complete: function() { jQuery(this).parent().parent().remove() } } ); 85 }); 86 87 wp_update_post_data(); 88 } 89 }; 90 91 /** 103 92 * Prepares menu items for POST 104 93 */ 105 94 function wp_update_post_data() { 106 95 var i = 0; 107 96 108 jQuery(' #menu li').each(function(i) {97 jQuery('.menu li').each(function(i) { 109 98 i = i + 1; 110 99 var j = jQuery(this).attr('value'); 111 100 112 jQuery(this).find('# position' + j).attr('value', i);101 jQuery(this).find('#item-position' + j).attr('value', i); 113 102 jQuery(this).attr('id','menu-' + i); 114 103 jQuery(this).attr('value', i); 115 104 116 jQuery(this).find('# dbid' + j).attr('name','dbid' + i);117 jQuery(this).find('# dbid' + j).attr('id','dbid' + i);105 jQuery(this).find('#item-dbid' + j).attr('name','item-dbid' + i); 106 jQuery(this).find('#item-dbid' + j).attr('id','item-dbid' + i); 118 107 119 jQuery(this).find('# postmenu' + j).attr('name','postmenu' + i);120 jQuery(this).find('# postmenu' + j).attr('id','postmenu' + i);108 jQuery(this).find('#item-postmenu' + j).attr('name','item-postmenu' + i); 109 jQuery(this).find('#item-postmenu' + j).attr('id','item-postmenu' + i); 121 110 122 var p = jQuery(this).find('# parent' + j).parent().parent().parent().attr('value');111 var p = jQuery(this).find('#item-parent' + j).parent().parent().parent().attr('value'); 123 112 124 jQuery(this).find('# parent' + j).attr('name','parent' + i);125 jQuery(this).find('# parent' + j).attr('id','parent' + i);113 jQuery(this).find('#item-parent' + j).attr('name','item-parent' + i); 114 jQuery(this).find('#item-parent' + j).attr('id','item-parent' + i); 126 115 127 116 if (p) { 128 117 // Do nothing … … 131 120 p = 0; 132 121 } 133 122 134 jQuery(this).find('# parent' + j).attr('value', p);123 jQuery(this).find('#item-parent' + j).attr('value', p); 135 124 136 125 jQuery(this).find('#item-title' + j).attr('name','item-title' + i); 137 126 jQuery(this).find('#item-title' + j).attr('id','item-title' + i); … … 148 137 jQuery(this).find('#item-target' + j).attr('name','item-target' + i); 149 138 jQuery(this).find('#item-target' + j).attr('id','item-target' + i); 150 139 151 jQuery(this).find('# position' + j).attr('name', 'position' + i);152 jQuery(this).find('# position' + j).attr('id', 'position' + i);140 jQuery(this).find('#item-position' + j).attr('name', 'item-position' + i); 141 jQuery(this).find('#item-position' + j).attr('id', 'item-position' + i); 153 142 154 jQuery(this).find('# linktype' + j).attr('name', 'linktype' + i);155 jQuery(this).find('# linktype' + j).attr('id', 'linktype' + i);143 jQuery(this).find('#item-type' + j).attr('name', 'item-type' + i); 144 jQuery(this).find('#item-type' + j).attr('id', 'item-type' + i); 156 145 157 146 jQuery('#li-count').attr( 'value', i ); 158 147 }); … … 169 158 * @param int itemparentid - default 0. 170 159 * @param string itemdescription - the description of the menu item. 171 160 */ 172 function wp_add_item_to_menu( additemtype, itemtext, itemurl, itemid, itemparentid, itemdescription ) { 173 var inputvaluevarname = ''; 174 var inputvaluevarurl = ''; 175 var inputitemid = ''; 176 var inputparentid= ''; 177 var inputdescription = ''; 161 function wp_add_item_to_menu( item_type, item_title, item_url, item_id, item_parent_id, item_description ) { 178 162 var randomnumber = wp_get_unique_menu_id(); 179 180 inputvaluevarname = htmlentities(itemtext.toString());181 inputvaluevarurl = itemurl.toString();182 inputitemid = itemid;183 inputparentid = itemparentid;184 inputlinktype = 'custom';185 inputdescription = htmlentities(itemdescription.toString());186 163 187 164 // Adds the item in the queue 188 jQuery(' #menu').append('<li id="menu-' + randomnumber + '" value="' + randomnumber + '"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="item-title">' + inputvaluevarname + '</span><span class="item-controls"><span class="item-type">' + additemtype + '</span><a class="item-edit thickbox" id="edit' + randomnumber + '" value="' + randomnumber +'" onClick="wp_edit_menu_item('+ randomnumber +')" title="' + navMenuL10n.thickbox + '" href="#TB_inline?height=380&width=300&inlineId=menu-item-settings">' + navMenuL10n.edit + '</a> | <a class="item-delete" id="delete' + randomnumber + '" value="' + randomnumber +'">Delete</a></span></dt></dl><a class="hide" href="' + inputvaluevarurl + '">' + inputvaluevarname + '</a><input type="hidden" name="postmenu' + randomnumber + '" id="postmenu' + randomnumber + '" value="' + inputitemid + '" /><input type="hidden" name="parent' + randomnumber + '" id="parent' + randomnumber + '" value="' + inputparentid + '" /><input type="hidden" name="item-title' + randomnumber + '" id="item-title' + randomnumber + '" value="' + inputvaluevarname + '" /><input type="hidden" name="item-url' + randomnumber + '" id="item-url' + randomnumber + '" value="' + inputvaluevarurl + '" /><input type="hidden" name="item-description' + randomnumber + '" id="item-description' + randomnumber + '" value="' + inputdescription + '" /><input type="hidden" name="position' + randomnumber + '" id="position' + randomnumber + '" value="' + randomnumber + '" /><input type="hidden" name="linktype' + randomnumber + '" id="linktype' + randomnumber + '" value="' + inputlinktype + '" /><input type="hidden" name="item-attr-title' + randomnumber + '" id="item-attr-title' + randomnumber + '" value="' + inputvaluevarname + '" /><input type="hidden" name="item-target' + randomnumber + '" id="item-target' + randomnumber + '" value="0" /></li>');165 jQuery('.menu').append('<li id="menu-' + randomnumber + '" value="' + randomnumber + '"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="item-title">' + item_title + '</span><span class="item-controls"><span class="item-type">' + item_type + '</span><a class="item-edit thickbox" id="edit' + randomnumber + '" value="' + randomnumber +'" onClick="wp_edit_menu_item('+ randomnumber +')" title="' + navMenuL10n.thickbox + '" href="#TB_inline?height=380&width=300&inlineId=menu-item-settings">' + navMenuL10n.edit + '</a> | <a class="item-delete" id="delete' + randomnumber + '" value="' + randomnumber +'">Delete</a></span></dt></dl><input type="hidden" name="item-postmenu' + randomnumber + '" id="item-postmenu' + randomnumber + '" value="' + item_id + '" /><input type="hidden" name="item-parent' + randomnumber + '" id="item-parent' + randomnumber + '" value="' + item_parent_id + '" /><input type="hidden" name="item-title' + randomnumber + '" id="item-title' + randomnumber + '" value="' + item_title + '" /><input type="hidden" name="item-url' + randomnumber + '" id="item-url' + randomnumber + '" value="' + item_url + '" /><input type="hidden" name="item-description' + randomnumber + '" id="item-description' + randomnumber + '" value="' + item_description + '" /><input type="hidden" name="item-position' + randomnumber + '" id="item-position' + randomnumber + '" value="' + randomnumber + '" /><input type="hidden" name="item-type' + randomnumber + '" id="item-type' + randomnumber + '" value="' + item_type + '" /><input type="hidden" name="item-attr-title' + randomnumber + '" id="item-attr-title' + randomnumber + '" value="' + item_title + '" /><input type="hidden" name="item-target' + randomnumber + '" id="item-target' + randomnumber + '" value="0" /></li>'); 189 166 190 167 // Give some feedback to the user 191 jQuery( ' #menu #menu-' + randomnumber + ' dt:first' ).animate( { backgroundColor: '#FFFF33' }, { duration: 'normal', complete: function() { jQuery(this).css( 'backgroundColor', '' ); }});168 jQuery( '.menu #menu-' + randomnumber + ' dt:first' ).animate( { backgroundColor: '#FFFF33' }, { duration: 'normal', complete: function() { jQuery(this).css( 'backgroundColor', '' ); }}); 192 169 193 170 // Enable drag-n-drop 194 171 wp_drag_and_drop(); 195 172 173 wp_update_post_data(); 174 196 175 // Reload thickbox 197 176 tb_init('a.thickbox, area.thickbox, input.thickbox'); 198 177 }; … … 200 179 /* 201 180 * Queues items in perperation for appendToList 202 181 * 203 * @param string id - The menu item's id 204 * @param string additemtype - Page, Category, or Custom. 205 * @param string itemtext - menu text. 206 * @param string itemurl - url of the menu. 207 * @param int itemid - menu id. 208 * @param int itemparentid - default 0. 209 * @param string itemdescription - the description of the menu item. 182 * @param string type - Page, Category, or Custom. 183 * @param string link - menu text. 184 * @param string url - url of the menu. 185 * @param int id - menu id. 186 * @param int parent_id - default 0. 187 * @param string description - the description of the menu item. 210 188 */ 211 function wp_update_queue( additemtype, itemtext, itemurl, itemid, itemparentid, itemdescription ) { 212 var inputvaluevarname = ''; 213 var inputvaluevarurl = ''; 214 var inputitemid = ''; 215 var inputparentid= ''; 216 var inputdescription = ''; 189 function wp_update_queue( e, item_type, item_title, item_url, item_id, item_parent_id, item_description ) { 217 190 var randomnumber = wp_get_unique_menu_id(); 218 219 if ( additemtype == navMenuL10n.page ) { 220 inputvaluevarname = htmlentities(itemtext.toString()); 221 inputvaluevarurl = itemurl.toString(); 222 inputitemid = itemid.toString(); 223 inputparentid = '0'; 224 inputlinktype = 'page'; 225 inputdescription = htmlentities(itemdescription.toString()); 226 227 } else if ( additemtype == navMenuL10n.category ) { 228 inputvaluevarname = htmlentities(itemtext.toString()); 229 inputvaluevarurl = itemurl.toString(); 230 inputitemid = itemid.toString(); 231 inputparentid = '0'; 232 inputlinktype = 'category'; 233 inputdescription = htmlentities(itemdescription.toString()); 234 } 235 236 // Adds or removes the item from the queue 237 if ( jQuery(menu_item_id = '#menu-item-' + inputitemid).attr('checked') ) { 238 191 var menu_item_id = jQuery(e).attr('id'); 192 193 if ( jQuery(e).attr('checked') ) { 239 194 // Add menu item to the queue 240 jQuery('#queue').append('<li id="menu-' + randomnumber + '" value="' + randomnumber + '"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="item-title">' + inputvaluevarname + '</span><span class="item-controls"><span class="item-type">' + additemtype + '</span><a class="item-edit thickbox" id="edit' + randomnumber + '" value="' + randomnumber +'" onClick="wp_edit_menu_item('+ randomnumber +')" title="' + navMenuL10n.thickbox + '" href="#TB_inline?height=380&width=300&inlineId=menu-item-settings">' + navMenuL10n.edit + '</a> | <a class="item-delete" id="delete' + randomnumber + '" value="' + randomnumber +'">Delete</a></span></dt></dl><a class="hide" href="' + inputvaluevarurl + '">' + inputvaluevarname + '</a><input type="hidden" name="postmenu' + randomnumber + '" id="postmenu' + randomnumber + '" value="' + inputitemid + '" /><input type="hidden" name="parent' + randomnumber + '" id="parent' + randomnumber + '" value="' + inputparentid + '" /><input type="hidden" name="item-title' + randomnumber + '" id="item-title' + randomnumber + '" value="' + inputvaluevarname + '" /><input type="hidden" name="item-url' + randomnumber + '" id="item-url' + randomnumber + '" value="' + inputvaluevarurl + '" /><input type="hidden" name="item-description' + randomnumber + '" id="item-description' + randomnumber + '" value="' + inputdescription + '" /><input type="hidden" name="position' + randomnumber + '" id="position' + randomnumber + '" value="' + randomnumber + '" /><input type="hidden" name="linktype' + randomnumber + '" id="linktype' + randomnumber + '" value="' + inputlinktype + '" /><input type="hidden" name="item-attr-title' + randomnumber + '" id="item-attr-title' + randomnumber + '" value="' + inputvaluevarname + '" /><input type="hidden" name="item-target' + randomnumber + '" id="item-target' + randomnumber + '" value="0" /></li>'); 241 } else { 195 jQuery('#queue').append('<li id="menu-' + randomnumber + '" value="' + randomnumber + '"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="item-title">' + item_title + '</span><span class="item-controls"><span class="item-type">' + item_type + '</span><a class="item-edit thickbox" id="edit' + randomnumber + '" value="' + randomnumber +'" onClick="wp_edit_menu_item('+ randomnumber +')" title="' + navMenuL10n.thickbox + '" href="#TB_inline?height=380&width=300&inlineId=menu-item-settings">' + navMenuL10n.edit + '</a> | <a class="item-delete" id="delete' + randomnumber + '" value="' + randomnumber +'">Delete</a></span></dt></dl><input type="hidden" name="item-postmenu' + randomnumber + '" id="item-postmenu' + randomnumber + '" value="' + item_id + '" /><input type="hidden" name="item-parent' + randomnumber + '" id="item-parent' + randomnumber + '" value="' + item_parent_id + '" /><input type="hidden" name="item-title' + randomnumber + '" id="item-title' + randomnumber + '" value="' + item_title + '" /><input type="hidden" name="item-url' + randomnumber + '" id="item-url' + randomnumber + '" value="' + item_url + '" /><input type="hidden" name="item-description' + randomnumber + '" id="item-description' + randomnumber + '" value="' + item_description + '" /><input type="hidden" name="item-position' + randomnumber + '" id="item-position' + randomnumber + '" value="' + randomnumber + '" /><input type="hidden" name="item-type' + randomnumber + '" id="item-type' + randomnumber + '" value="' + item_type + '" /><input type="hidden" name="item-attr-title' + randomnumber + '" id="item-attr-title' + randomnumber + '" value="' + item_title + '" /><input type="hidden" name="item-target' + randomnumber + '" id="item-target' + randomnumber + '" value="0" /><input type="hidden" name="item-id' + randomnumber + '" id="item-id' + randomnumber + '" value="'+ menu_item_id +'" /></li>'); 242 196 243 // Get the item in the queue 244 for ( var i = 0; i < jQuery('#queue li input[name^="postmenu"]').length; i++ ) { 245 if ( itemid == jQuery('#queue li input[name^="postmenu"]')[i].value ) { 246 var menu_queue_id = jQuery('#queue li input[name^="postmenu"]')[i].name.substring( 8, jQuery('#queue li input[name^="postmenu"]')[i].name.length ); 247 }; 197 } else { 198 // Remove the item from the queue 199 if ( menu_item_id == jQuery('#queue li input[name^="item-id"]' ).val() ) { 200 jQuery('#queue li input[name^="item-id"]' ).parent().remove() 248 201 }; 249 250 // Removes the item from the queue251 jQuery('#queue li#menu-' + menu_queue_id).remove();252 202 }; 253 203 }; 254 204 … … 265 215 jQuery('#queue').empty(); 266 216 267 217 // Appends HTML to the menu 268 jQuery(' #menu').append( items );218 jQuery('.menu').append( items ); 269 219 270 220 // Give some feedback to the user 271 221 jQuery(items).each(function(){ … … 288 238 * Allow the items in the Menu to be dragged and dropped. 289 239 */ 290 240 function wp_drag_and_drop() { 241 // Make sure all li's have dropzones 242 jQuery('.menu li').each(function(){ 243 if ( !jQuery(this).children('.dropzone').attr('class') ) { 244 jQuery(this).prepend('<div class="dropzone"></div>'); 245 }; 246 }); 247 291 248 // make menu item draggable 292 jQuery(' #menu li').draggable({249 jQuery('.menu li').draggable({ 293 250 handle: ' > dl', 294 251 opacity: .8, 295 252 addClasses: false, 296 253 helper: 'clone', 297 zIndex: 100 254 zIndex: 100, 298 255 }); 299 256 300 257 // make menu item droppable 301 jQuery(' #menu li dl, #menu li .dropzone').droppable({302 accept: ' #menu li',258 jQuery('.menu li dl, .menu li .dropzone').droppable({ 259 accept: '.menu li', 303 260 tolerance: 'pointer', 304 261 drop: function(e, ui) { 305 262 var li = jQuery(this).parent(); … … 307 264 308 265 // Append UL to first child 309 266 if ( child && li.children('ul').length == 0 ) { 310 li.append( '<ul />' );267 li.append( '<ul class="sub-menu" />' ); 311 268 } 312 269 // Make it draggable 313 270 if ( child ) { … … 322 279 var droppablevalue = li.attr('value'); 323 280 324 281 li.find('#menu-' + draggablevalue).find('#parent' + draggablevalue).val(droppablevalue); 325 jQuery(this).parent().find( "dt").removeAttr('style');326 jQuery(this).parent().find( "div:first").removeAttr('style');282 jQuery(this).parent().find('dt').removeAttr('style'); 283 jQuery(this).parent().find('div:first').removeAttr('style'); 327 284 328 285 }, 329 286 over: function() { 330 287 // Add child 331 288 if ( jQuery(this).attr('class') == 'dropzone ui-droppable' ) { 332 jQuery(this).parent().find( "div:first").css('background', 'none').css('height', '50px');289 jQuery(this).parent().find('div:first').css('background', 'none').css('height', '50px'); 333 290 } 334 291 // Add above 335 292 else if ( jQuery(this).attr('class') == 'ui-droppable' ) { 336 jQuery(this).parent().find( "dt:first").css('background', '#d8d8d8');293 jQuery(this).parent().find('dt:first').css('background', '#d8d8d8'); 337 294 } else { 338 295 // do nothing 339 296 } … … 341 298 342 299 }, 343 300 out: function() { 344 jQuery(this).parent().find( "dt").removeAttr('style');345 jQuery(this).parent().find( "div:first").removeAttr('style');301 jQuery(this).parent().find('dt').removeAttr('style'); 302 jQuery(this).parent().find('div:first').removeAttr('style'); 346 303 jQuery(this).filter('.dropzone').css({ borderColor: '' }); 347 304 } 348 305 } … … 353 310 * Gets a unique number based on how many items are in the menu 354 311 */ 355 312 function wp_get_unique_menu_id() { 356 var count = document.getElementById('menu').getElementsByTagName('li').length + 1;313 var count = jQuery('.menu li').length + 1; 357 314 var randomnumber = count; 358 315 var validatetest = 0; 359 316 -
wp-admin/js/nav-menu-default-items.js
1 jQuery(document).ready(function($){ $("#save_menu").click(function(){wp_update_post_data()});$(".quick-search").click(function(){$(this).attr("value","")});$(".quick-search-submit").click(function(){$(this).siblings(".quick-search").search()});$("#menu-container .item-edit").click(function(){wp_edit_menu_item($(this).attr("value"))});$("#menu-container .item-delete").live("click",function(){wp_remove_menu_item($(this).attr("value"))});$("#update-menu-item").click(function(){wp_update_menu_item();tb_remove();var id=$("#edit-item-id").val();$("#menu-"+id+" dt:first").animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){jQuery(this).css("backgroundColor","")}})});$("#cancel-save").click(function(){tb_remove()});$(".show-all").click(function(){$(this).offsetParent().find("#add-buttons-actions").attr("style","margin-bottom: 10px;");$(this).offsetParent().find(".list-wrap").css("display","block");$(this).siblings(".quick-search").attr("value","");$(this).offsetParent().find(".list-wrap dt").css("display","block");$(this).hide();$(this).siblings(".hide-all").show()});$(".hide-all").click(function(){$(this).offsetParent().find("#add-buttons-actions").attr("style","margin-bottom: 0px;");$(this).offsetParent().find(".list-wrap").css("display","none");$(this).siblings(".quick-search").attr("value","Search");$(this).offsetParent().find(".list-wrap dt").css("display","none");$(this).hide();$(this).siblings(".show-all").show()});$(".enqueue a").click(function(){wp_add_queued_items_to_menu(this)});$("#add-custom-link .add-to-menu a").click(function(){var link_url=$(this).offsetParent().find("#menu-item-url").val();var link_name=$(this).offsetParent().find("#menu-item-name").val();var links=$(this).offsetParent().find("#available-links input:checked");if(links){for(var i=0;i<links.length;i++){wp_add_item_to_menu("Custom",links[i].name,links[i].value,links[i].id.substring(5,links[i].id.length),0,"")}$(links).attr("checked",false)}if("http://"==link_url||"Menu Item"==link_name){return}params={action:"add-menu-link",link_url:link_url,link_name:link_name,};$.post(ajaxurl,params,function(response){if(null==response||"-1"==response){return false}params.link_id=response;wp_add_item_to_menu("Custom",params.link_name,params.link_url,params.link_id,0,"")},"json")});$("#menu li").prepend('<div class="dropzone"></div>');$("#menu li").draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100});$("#menu dl, #menu .dropzone").droppable({accept:"#menu li",tolerance:"pointer",drop:function(e,ui){var li=$(this).parent();var child=!$(this).hasClass("dropzone");if(child&&li.children("ul").length==0){li.append('<ul id="sub-menu" />')}if(child){li.children("ul").append(ui.draggable)}else{li.before(ui.draggable)}li.find("dl,.dropzone").css({backgroundColor:"",borderColor:""});var draggablevalue=ui.draggable.attr("value");var droppablevalue=li.attr("value");li.find("#menu-"+draggablevalue).find("#parent"+draggablevalue).val(droppablevalue);$(this).parent().find("dt").removeAttr("style");$(this).parent().find("div:first").removeAttr("style")},over:function(){if("dropzone ui-droppable"==$(this).attr("class")){$(this).parent().find("dt:first").css("background","none").css("height","50px")}else{if($(this).attr("class")=="ui-droppable"){$(this).parent().find("dt:first").css("background","#d8d8d8")}else{}}var parentid=$(this).parent().attr("id")},out:function(){$(this).parent().find("dt").removeAttr("style");$(this).parent().find("div:first").removeAttr("style");$(this).filter(".dropzone").css({borderColor:""})},deactivate:function(){}})});2 No newline at end of file 1 jQuery(document).ready(function($){wp_drag_and_drop();wp_update_post_data();$("#save_menu").click(function(){return wp_update_post_data()});$(".quick-search").click(function(){$(this).attr("value","")});$(".quick-search-submit").click(function(){$(this).siblings(".quick-search").search()});$("#menu-container .item-edit").click(function(){return wp_edit_menu_item($(this).attr("value"))});$("#menu-container .item-delete").live("click",function(){return wp_remove_menu_item($(this).attr("value"))});$("#update-menu-item").click(function(){wp_update_menu_item();tb_remove();var id=$("#edit-item-id").val();$("#menu-"+id+" dt:first").animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){jQuery(this).css("backgroundColor","")}})});$("#cancel-save").click(function(){return tb_remove()});$(".show-all").click(function(){$(this).offsetParent().find("#add-buttons-actions").attr("style","margin-bottom: 10px;");$(this).offsetParent().find(".list-wrap").css("display","block");$(this).siblings(".quick-search").attr("value","");$(this).offsetParent().find(".list-wrap li").css("display","block");$(this).hide();$(this).siblings(".hide-all").show()});$(".hide-all").click(function(){$(this).offsetParent().find("#add-buttons-actions").attr("style","margin-bottom: 0px;");$(this).offsetParent().find(".list-wrap").css("display","none");$(this).siblings(".quick-search").attr("value","Search");$(this).offsetParent().find(".list-wrap li").css("display","none");$(this).hide();$(this).siblings(".show-all").show()});$(".list input").click(function(){var item_type=jQuery(this).parent().siblings(".item-type").val();var item_title=jQuery(this).parent().siblings(".item-title").val();var item_url=jQuery(this).parent().siblings(".item-url").val();var item_id=jQuery(this).parent().siblings(".item-id").val();var item_parent_id=jQuery(this).parent().siblings(".item-parent-id").val();var item_description=jQuery(this).parent().siblings(".item-description").val();return wp_update_queue($(this),item_type,item_title,item_url,item_id,item_parent_id,item_description)});$(".enqueue a").click(function(){return wp_add_queued_items_to_menu(this)});$("#add-custom-link .add-to-menu a").click(function(){var link_url=$(this).offsetParent().find("#menu-item-url").val();var link_name=$(this).offsetParent().find("#menu-item-name").val();wp_add_queued_items_to_menu(this);if("http://"==link_url||"Menu Item"==link_name){return}params={action:"add-menu-link",link_url:link_url,link_name:link_name,};$.post(ajaxurl,params,function(response){if(null==response||"-1"==response){return false}params.link_id=response;wp_add_item_to_menu("Custom",params.link_name,params.link_url,params.link_id,0,"")},"json")})}); 2 No newline at end of file -
wp-admin/nav-menus.php
43 43 $updated = false; 44 44 $advanced_option_descriptions = 'no'; 45 45 46 // Get all menu link items47 $available_links = new WP_Query( array( 'post_status' => 'any', 'post_type' => 'nav_menu_item', 'meta_key' => 'menu_type', 'meta_value' => 'custom' ) );48 49 46 // Check which menu is selected and if menu is in edit already 50 47 if ( isset( $_GET['edit-menu'] ) ) { 51 48 $menu_selected_id = (int) $_GET['edit-menu']; … … 127 124 128 125 // Loop through all POST variables 129 126 for ( $k = 1; $k <= $post_counter; $k++ ) { 130 $db_id = isset( $_POST[' dbid'.$k] )? $_POST['dbid'.$k] : 0;131 $object_id = isset( $_POST[' postmenu'.$k] )? $_POST['postmenu'.$k] : 0;132 $parent_id = isset( $_POST[' parent'.$k] )? $_POST['parent'.$k] : 0;127 $db_id = isset( $_POST['item-dbid'.$k] )? $_POST['item-dbid'.$k] : 0; 128 $object_id = isset( $_POST['item-postmenu'.$k] )? $_POST['item-postmenu'.$k] : 0; 129 $parent_id = isset( $_POST['item-parent'.$k] )? $_POST['item-parent'.$k] : 0; 133 130 $custom_title = isset( $_POST['item-title'.$k] )? $_POST['item-title'.$k] : ''; 134 131 $custom_linkurl = ( isset( $_POST['item-url'.$k] ) && 'custom' == $_POST['linktype'.$k] ) ? $_POST['item-url'.$k] : ''; 135 132 $custom_description = isset( $_POST['item-description'.$k] )? $_POST['item-description'.$k] : ''; 133 136 134 // doesn't seem to be used by UI 137 $icon = isset( $_POST['icon'.$k] )? $_POST['icon'.$k] : 0; 138 $position = isset( $_POST['position'.$k] )? $_POST['position'.$k] : 0; 139 $linktype = isset( $_POST['linktype'.$k] )? $_POST['linktype'.$k] : 'custom'; 135 $position = isset( $_POST['item-position'.$k] )? $_POST['item-position'.$k] : 0; 136 $linktype = isset( $_POST['item-type'.$k] )? $_POST['item-type'.$k] : 'custom'; 140 137 $custom_anchor_title = isset( $_POST['item-attr-title'.$k] )? $_POST['item-attr-title'.$k] : $custom_title; 141 138 $new_window = isset( $_POST['item-target'.$k] )? $_POST['item-target'.$k] : 0; 142 139 … … 209 206 <div class="inside"> 210 207 <input type="hidden" name="li-count" id="li-count" value="0" /> 211 208 <input type="hidden" name="menu-id-in-edit" id="menu-id-in-edit" value="<?php echo esc_attr( $menu_selected_id ); ?>" /> 212 213 <ul id="menu">214 209 <?php 215 if ( $menu_selected_id > 0 ) { 216 wp_print_nav_menu( array( 'type' => 'backend', 'name' => $menu_title, 'id' => $menu_selected_id ) ); 217 } 210 if ( $menu_selected_id > 0 ) 211 echo wp_get_nav_menu( array( 'type' => 'backend', 'menu' => $menu_selected_id, 'ul_class' => 'menu' ) ); 218 212 ?> 219 </ul><!-- /#menu-->220 213 221 214 <div id="queue" class="hide"> 222 215 </div><!--/#queue--> … … 265 258 </label> 266 259 </p> 267 260 268 <?php if ( $available_links->posts ) : ?>269 261 <p class="button-controls"> 270 262 <a class="show-all button"><?php _e('View All'); ?></a> 271 263 <a class="hide-all button"><?php _e('Hide All'); ?></a> … … 273 265 <div id="available-links" class="list-wrap"> 274 266 <div class="list-container"> 275 267 <ul class="list"> 276 <?php 277 foreach ( $available_links->posts as $link ) : 278 $url = get_post_meta( $link->ID, 'menu_link' ); 279 ?> 280 <li> 281 <dl> 282 <dt> 283 <label class="item-title"><input type="checkbox" id="link-<?php echo esc_attr($link->ID); ?>" name="<?php echo esc_attr($link->post_title); ?>" value="<?php echo esc_attr($url[0]); ?>" /><?php echo esc_html($link->post_title); ?></label> 284 </dt> 285 </dl> 286 </li> 287 <?php 288 endforeach; 289 ?> 268 <?php $items_counter = wp_nav_menu_get_custom_links( 0, 'default' ); ?> 290 269 </ul> 291 270 </div><!-- /.list-container--> 292 271 </div><!-- /#available-links--> 293 <?php endif; ?>294 272 <p class="add-to-menu"> 295 273 <a class="button"><?php _e('Add to Menu'); ?></a> 296 274 </p> … … 325 303 326 304 jQuery('#add-pages .quick-search').result(function(event, data, formatted) { 327 305 jQuery('#add-pages .list-wrap').css('display','block'); 328 jQuery("#add-pages .list-wrap dt:contains('" + data + "')").css('display','block');306 jQuery("#add-pages .list-wrap li:contains('" + data + "')").css('display','block'); 329 307 jQuery('#add-pages .show-all').hide(); 330 308 jQuery('#add-pages .hide-all').show(); 331 309 }); … … 344 322 <div id="existing-pages" class="list-wrap"> 345 323 <div class="list-container"> 346 324 <ul class="list"> 347 <?php $items_counter = wp_nav_menu_get_pages( 0, 'default' ); ?>325 <?php $items_counter = wp_nav_menu_get_pages( $items_counter, 'default' ); ?> 348 326 </ul> 349 327 </div><!-- /.list-container--> 350 328 </div><!-- /#existing-pages--> … … 387 365 jQuery('#add-categories .quick-search').autocomplete(categories); 388 366 jQuery('#add-categories .quick-search').result(function(event, data, formatted) { 389 367 jQuery('#add-categories .list-wrap').css('display','block'); 390 jQuery("#add-categories .list-wrap dt:contains('" + data + "')").css('display','block');368 jQuery("#add-categories .list-wrap li:contains('" + data + "')").css('display','block'); 391 369 jQuery('#add-categories .show-all').hide(); 392 370 jQuery('#add-categories .hide-all').show(); 393 371 }); -
wp-admin/css/nav-menu.css
1 #menu-management{clear:both;}#menu-management .inside{padding:0 10px;}#menu-container .submit{margin:0 0 10px;padding:0;}.submitdelete{color:#f00;text-decoration:underline;font-size:11px;float:left;margin-top:5px;}.submitdelete:hover{background-color:#F00;color:#fff;}.save{float:right;}.button-controls{float:left;}.add-to-menu{float:right;}#create-menu-name{width:159px;}#available-links{margin:15px 0 0;}#available-links dt{display:block;}#add-custom-link .howto{font-size:11px;}#add-custom-link label span{display:block;float:left;margin-top:5px;padding-right:5px;}#menu-item-url,#menu-item-name{float:right;width:220px;}.show-all,.hide-all{cursor:pointer;}.hide-all{display:none;}.quick-search{width:190px;}.list-wrap{display:none;clear:both;}.list-container{max-height:200px;overflow-y:auto;padding:10px 10px 5px;border:1px solid #DFDFDF;-moz-border-radius:4px;}.postbox p.submit{margin-bottom:0;}.list li{ margin:0;}.list dt{display:none;margin:0;overflow:hidden;margin-bottom:5px;}.list li .item-title{cursor:pointer;display:block;}.list li .item-title input{margin-right:3px;margin-top:-3px;}.list li ul li .item-title{margin-left:14px;}.list li ul li ul li .item-title{margin-left:28px;}.list li ul li ul li ul li .item-title{margin-left:42px;}.list li ul li ul li ul li ul li .item-title{margin-left:56px;}.list li ul li ul li ul li ul li ul li .item-title{margin-left:70px;}.list li ul li ul li ul li ul li ul li ul li .item-title{margin-left:84px;}.list li ul li ul li ul li ul li ul li ul li ul li .item-title{margin-left:98px;}.list li ul li ul li ul li ul li ul li ul li ul li ul li .item-title{margin-left:112px;}#menu-container .inside{padding-bottom:10px;}#menu ul{width:100%;}#menu li{margin:0;}#menu li dl dt{-webkit-border-bottom-left-radius:6px;-webkit-border-bottom-right-radius:6px;-webkit-border-top-left-radius:6px;-webkit-border-top-right-radius:6px;border-bottom-left-radius:6px;border-bottom-right-radius:6px;border-top-left-radius:6px;border-top-right-radius:6px;-moz-border-radius-bottomleft:6px;-moz-border-radius-bottomright:6px;-moz-border-radius-topleft:6px;-moz-border-radius-topright:6px;border:1px solid #E6E6E6;position:relative;padding-left:10px;background-color:#f1f1f1;height:35px;line-height:35px;}#menu li dl dt:hover{cursor:move;}#menu li .item-title{background:url(../images/ico-arrow.png) no-repeat 4px 5px;background-position:center left;padding-left:15px;}#menu li ul li{margin-left:20px;opacity:.7;}#menu li ul li ul li{opacity:.9;}#menu li ul li ul li ul li{opacity:.9;}#menu li ul li ul li ul li ul li{opacity:.95;}.dropzone{height:7px;margin:3px 0 3px 0;}.ui-draggable-dragging{width:600px;}.item-type{text-transform:uppercase;font-size:11px;color:#999;padding-right:10px;}.item-controls{font-size:11px;position:absolute;right:15px;top:-1px;}.item-controls a{text-decoration:none;}.item-controls a:hover{cursor:pointer;}.item-controls .item-delete:hover{color:#f00;}#menu-item-settings{display:none;}#cancel-save{cursor:pointer;}#cancel-save:hover{color:#fff!important;}#update-menu-item{color:#fff!important;}#update-menu-item:hover,#update-menu-item:active,#update-menu-item:focus{color:#eaf2fa!important;border-color:#13455b!important;}.hide{display:none;}2 No newline at end of file 1 #menu-management{clear:both;}#menu-management .inside{padding:0 10px;}#menu-container .submit{margin:0 0 10px;padding:0;}.submitdelete{color:#f00;text-decoration:underline;font-size:11px;float:left;margin-top:5px;}.submitdelete:hover{background-color:#F00;color:#fff;}.save{float:right;}.button-controls{float:left;}.add-to-menu{float:right;}#create-menu-name{width:159px;}#available-links{margin:15px 0 0;}#available-links dt{display:block;}#add-custom-link .howto{font-size:11px;}#add-custom-link label span{display:block;float:left;margin-top:5px;padding-right:5px;}#menu-item-url,#menu-item-name{float:right;width:220px;}.show-all,.hide-all{cursor:pointer;}.hide-all{display:none;}.quick-search{width:190px;}.list-wrap{display:none;clear:both;}.list-container{max-height:200px;overflow-y:auto;padding:10px 10px 5px;border:1px solid #DFDFDF;-moz-border-radius:4px;}.postbox p.submit{margin-bottom:0;}.list li{display:none;margin:0;margin-bottom:5px;}.list li .item-title{cursor:pointer;display:block;}.list li .item-title input{margin-right:3px;margin-top:-3px;}.list li ul li .item-title{margin-left:14px;}.list li ul li ul li .item-title{margin-left:28px;}.list li ul li ul li ul li .item-title{margin-left:42px;}.list li ul li ul li ul li ul li .item-title{margin-left:56px;}.list li ul li ul li ul li ul li ul li .item-title{margin-left:70px;}.list li ul li ul li ul li ul li ul li ul li .item-title{margin-left:84px;}.list li ul li ul li ul li ul li ul li ul li ul li .item-title{margin-left:98px;}.list li ul li ul li ul li ul li ul li ul li ul li ul li .item-title{margin-left:112px;}#menu-container .inside{padding-bottom:10px;}.menu ul{width:100%;}.menu li{margin:0;}.menu li dl dt{-webkit-border-bottom-left-radius:6px;-webkit-border-bottom-right-radius:6px;-webkit-border-top-left-radius:6px;-webkit-border-top-right-radius:6px;border-bottom-left-radius:6px;border-bottom-right-radius:6px;border-top-left-radius:6px;border-top-right-radius:6px;-moz-border-radius-bottomleft:6px;-moz-border-radius-bottomright:6px;-moz-border-radius-topleft:6px;-moz-border-radius-topright:6px;border:1px solid #E6E6E6;position:relative;padding-left:10px;background-color:#f1f1f1;height:35px;line-height:35px;}.menu li dl dt:hover{cursor:move;}.menu li .item-title{background:url(../images/ico-arrow.png) no-repeat 4px 5px;background-position:center left;padding-left:15px;}.menu li ul li{margin-left:20px;opacity:.7;}.menu li ul li ul li{opacity:.9;}.menu li ul li ul li ul li{opacity:.9;}.menu li ul li ul li ul li ul li{opacity:.95;}.dropzone{height:7px;margin:3px 0 3px 0;}.ui-draggable-dragging{width:600px;}.item-type{text-transform:uppercase;font-size:11px;color:#999;padding-right:10px;}.item-controls{font-size:11px;position:absolute;right:15px;top:-1px;}.item-controls a{text-decoration:none;}.item-controls a:hover{cursor:pointer;}.item-controls .item-delete:hover{color:#f00;}#menu-item-settings{display:none;}#cancel-save{cursor:pointer;}#cancel-save:hover{color:#fff!important;}#update-menu-item{color:#fff!important;}#update-menu-item:hover,#update-menu-item:active,#update-menu-item:focus{color:#eaf2fa!important;border-color:#13455b!important;}.hide{display:none;} 2 No newline at end of file -
wp-admin/css/nav-menu.dev.css
22 22 .button-controls { float: left; } 23 23 .add-to-menu { float: right; } 24 24 25 /* CSS for switching the columns *//*25 /* CSS for switching the main columns *//* 26 26 #menu-settings-column { clear: none; float: left; } 27 27 #menu-management #post-body { float: right; margin-left: -340px; margin-right: 0px; } 28 28 #menu-management #post-body-content { margin-left: 300px; margin-right: 0px; } … … 48 48 .postbox p.submit { margin-bottom: 0; } 49 49 50 50 /* Listings */ 51 .list li { margin: 0; } 52 .list dt { display: none; margin: 0; overflow: hidden; margin-bottom: 5px; } 51 .list li { display: none; margin: 0; margin-bottom: 5px; } 53 52 54 53 .list li .item-title { cursor: pointer; display: block; } 55 54 .list li .item-title input { margin-right: 3px; margin-top: -3px; } … … 66 65 /* Menu */ 67 66 #menu-container .inside { padding-bottom: 10px; } 68 67 69 #menu ul { width: 100%; }70 #menu li { margin: 0; }71 #menu li dl dt { -webkit-border-bottom-left-radius: 6px; -webkit-border-bottom-right-radius: 6px; -webkit-border-top-left-radius: 6px; -webkit-border-top-right-radius: 6px; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; border-top-left-radius: 6px; border-top-right-radius: 6px; -moz-border-radius-bottomleft: 6px; -moz-border-radius-bottomright: 6px; -moz-border-radius-topleft: 6px; -moz-border-radius-topright: 6px; border: 1px solid #E6E6E6;position: relative; padding-left:10px; background-color: #f1f1f1; height: 35px; line-height: 35px; }72 #menu li dl dt:hover { cursor: move; }68 .menu ul { width: 100%; } 69 .menu li { margin: 0; } 70 .menu li dl dt { -webkit-border-bottom-left-radius: 6px; -webkit-border-bottom-right-radius: 6px; -webkit-border-top-left-radius: 6px; -webkit-border-top-right-radius: 6px; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; border-top-left-radius: 6px; border-top-right-radius: 6px; -moz-border-radius-bottomleft: 6px; -moz-border-radius-bottomright: 6px; -moz-border-radius-topleft: 6px; -moz-border-radius-topright: 6px; border: 1px solid #E6E6E6;position: relative; padding-left:10px; background-color: #f1f1f1; height: 35px; line-height: 35px; } 71 .menu li dl dt:hover { cursor: move; } 73 72 74 #menu li .item-title { background: url(../images/ico-arrow.png) no-repeat 4px 5px; background-position: center left; padding-left: 15px; }75 #menu li ul li { margin-left: 20px; opacity: .7;}76 #menu li ul li ul li { opacity: .9;}77 #menu li ul li ul li ul li { opacity: .9;}78 #menu li ul li ul li ul li ul li { opacity: .95; }73 .menu li .item-title { background: url(../images/ico-arrow.png) no-repeat 4px 5px; background-position: center left; padding-left: 15px; } 74 .menu li ul li { margin-left: 20px; opacity: .7;} 75 .menu li ul li ul li { opacity: .9;} 76 .menu li ul li ul li ul li { opacity: .9;} 77 .menu li ul li ul li ul li ul li { opacity: .95; } 79 78 80 79 /* Drag and Drop */ 81 80 .dropzone { height: 7px; margin: 3px 0 3px 0; }