Make WordPress Core

Ticket #23450: 23450.1.refactored.diff

File 23450.1.refactored.diff, 30.4 KB (added by lessbloat, 11 years ago)

Removed code from 23449.2.diff (which was committed yesterday)

  • wp-admin/includes/nav-menu.php

     
    381381 * @since 3.0.0
    382382 **/
    383383function wp_nav_menu_setup() {
    384         // Register meta boxes
    385         if ( wp_get_nav_menus() )
    386                 add_meta_box( 'nav-menu-theme-locations', __( 'Theme Locations' ), 'wp_nav_menu_locations_meta_box' , 'nav-menus', 'side', 'default' );
    387         add_meta_box( 'add-custom-links', __('Custom Links'), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
    388384        wp_nav_menu_post_type_meta_boxes();
     385        wp_nav_menu_item_link_meta_box();
    389386        wp_nav_menu_taxonomy_meta_boxes();
    390387
    391388        // Register advanced menu items (columns)
     
    445442                $post_type = apply_filters( 'nav_menu_meta_box_object', $post_type );
    446443                if ( $post_type ) {
    447444                        $id = $post_type->name;
    448                         add_meta_box( "add-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', 'default', $post_type );
     445                        wp_nav_menu_item_post_type_meta_box( $post_type );
    449446                }
    450447        }
    451448}
     
    465462                $tax = apply_filters( 'nav_menu_meta_box_object', $tax );
    466463                if ( $tax ) {
    467464                        $id = $tax->name;
    468                         add_meta_box( "add-{$id}", $tax->labels->name, 'wp_nav_menu_item_taxonomy_meta_box', 'nav-menus', 'side', 'default', $tax );
     465                        wp_nav_menu_item_taxonomy_meta_box( $tax );
    469466                }
    470467        }
    471468}
     
    542539        );
    543540
    544541        ?>
    545         <div class="customlinkdiv" id="customlinkdiv">
     542        <li class="control-section accordion-section" id="accordion-section-title_tagline">
     543                <h3 title="" tabindex="0" class="accordion-section-title"><?php _e('Links'); ?></h3>
     544                <div class="customlinkdiv accordion-section-content" id="customlinkdiv">
    546545
    547546                        <input type="hidden" value="custom" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-type]" />
    548547                        <p id="menu-item-url-wrap">
     
    559558                                </label>
    560559                        </p>
    561560
    562                 <p class="button-controls">
    563                         <span class="add-to-menu">
    564                                 <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-custom-menu-item" id="submit-customlinkdiv" />
    565                                 <span class="spinner"></span>
    566                         </span>
    567                 </p>
     561                        <p class="button-controls">
     562                                <span class="add-to-menu">
     563                                        <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-custom-menu-item" id="submit-customlinkdiv" />
     564                                        <span class="spinner"></span>
     565                                </span>
     566                        </p>
    568567
    569         </div><!-- /.customlinkdiv -->
     568                </div><!-- /.customlinkdiv -->
     569        </li>
    570570        <?php
    571571}
    572572
     
    578578 * @param string $object Not used.
    579579 * @param string $post_type The post type object.
    580580 */
    581 function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) {
     581function wp_nav_menu_item_post_type_meta_box( $post_type ) {
    582582        global $_nav_menu_placeholder, $nav_menu_selected_id;
    583583
    584         $post_type_name = $post_type['args']->name;
     584        $post_type_name = $post_type->name;
    585585
    586586        // paginate browsing for large numbers of post objects
    587587        $per_page = 50;
     
    599599                'update_post_meta_cache' => false
    600600        );
    601601
    602         if ( isset( $post_type['args']->_default_query ) )
    603                 $args = array_merge($args, (array) $post_type['args']->_default_query );
     602        if ( isset( $post_type->_default_query ) )
     603                $args = array_merge($args, (array) $post_type->_default_query );
    604604
    605605        // @todo transient caching of these results with proper invalidation on updating of a post of this type
    606606        $get_posts = new WP_Query;
     
    659659        );
    660660
    661661        ?>
    662         <div id="posttype-<?php echo $post_type_name; ?>" class="posttypediv">
    663                 <ul id="posttype-<?php echo $post_type_name; ?>-tabs" class="posttype-tabs add-menu-item-tabs">
    664                         <li <?php echo ( 'most-recent' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'most-recent', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent"><?php _e('Most Recent'); ?></a></li>
    665                         <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#<?php echo $post_type_name; ?>-all"><?php _e('View All'); ?></a></li>
    666                         <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-search"><?php _e('Search'); ?></a></li>
    667                 </ul>
    668 
    669                 <div id="tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent" class="tabs-panel <?php
    670                         echo ( 'most-recent' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
    671                 ?>">
    672                         <ul id="<?php echo $post_type_name; ?>checklist-most-recent" class="categorychecklist form-no-clear">
    673                                 <?php
    674                                 $recent_args = array_merge( $args, array( 'orderby' => 'post_date', 'order' => 'DESC', 'posts_per_page' => 15 ) );
    675                                 $most_recent = $get_posts->query( $recent_args );
    676                                 $args['walker'] = $walker;
    677                                 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $most_recent), 0, (object) $args );
    678                                 ?>
     662        <li class="control-section accordion-section" id="accordion-section-title_tagline">
     663                <h3 title="" tabindex="0" class="accordion-section-title"><?php echo $post_type->labels->name; ?></h3>
     664                <div id="posttype-<?php echo $post_type_name; ?>" class="posttypediv accordion-section-content">
     665                        <ul id="posttype-<?php echo $post_type_name; ?>-tabs" class="posttype-tabs add-menu-item-tabs">
     666                                <li <?php echo ( 'most-recent' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'most-recent', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent"><?php _e('Most Recent'); ?></a></li>
     667                                <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#<?php echo $post_type_name; ?>-all"><?php _e('View All'); ?></a></li>
     668                                <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-search"><?php _e('Search'); ?></a></li>
    679669                        </ul>
    680                 </div><!-- /.tabs-panel -->
    681670
    682                 <div class="tabs-panel <?php
    683                         echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
    684                 ?>" id="tabs-panel-posttype-<?php echo $post_type_name; ?>-search">
    685                         <?php
    686                         if ( isset( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) {
    687                                 $searched = esc_attr( $_REQUEST['quick-search-posttype-' . $post_type_name] );
    688                                 $search_results = get_posts( array( 's' => $searched, 'post_type' => $post_type_name, 'fields' => 'all', 'order' => 'DESC', ) );
    689                         } else {
    690                                 $searched = '';
    691                                 $search_results = array();
    692                         }
    693                         ?>
    694                         <p class="quick-search-wrap">
    695                                 <input type="search" class="quick-search input-with-default-title" title="<?php esc_attr_e('Search'); ?>" value="<?php echo $searched; ?>" name="quick-search-posttype-<?php echo $post_type_name; ?>" />
    696                                 <span class="spinner"></span>
    697                                 <?php submit_button( __( 'Search' ), 'button-small quick-search-submit button-secondary hide-if-js', 'submit', false, array( 'id' => 'submit-quick-search-posttype-' . $post_type_name ) ); ?>
    698                         </p>
     671                        <div id="tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent" class="tabs-panel <?php
     672                                echo ( 'most-recent' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
     673                        ?>">
     674                                <ul id="<?php echo $post_type_name; ?>checklist-most-recent" class="categorychecklist form-no-clear">
     675                                        <?php
     676                                        $recent_args = array_merge( $args, array( 'orderby' => 'post_date', 'order' => 'DESC', 'posts_per_page' => 15 ) );
     677                                        $most_recent = $get_posts->query( $recent_args );
     678                                        $args['walker'] = $walker;
     679                                        echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $most_recent), 0, (object) $args );
     680                                        ?>
     681                                </ul>
     682                        </div><!-- /.tabs-panel -->
    699683
    700                         <ul id="<?php echo $post_type_name; ?>-search-checklist" data-wp-lists="list:<?php echo $post_type_name?>" class="categorychecklist form-no-clear">
    701                         <?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?>
     684                        <div class="tabs-panel <?php
     685                                echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
     686                        ?>" id="tabs-panel-posttype-<?php echo $post_type_name; ?>-search">
    702687                                <?php
    703                                 $args['walker'] = $walker;
    704                                 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $search_results), 0, (object) $args );
     688                                if ( isset( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) {
     689                                        $searched = esc_attr( $_REQUEST['quick-search-posttype-' . $post_type_name] );
     690                                        $search_results = get_posts( array( 's' => $searched, 'post_type' => $post_type_name, 'fields' => 'all', 'order' => 'DESC', ) );
     691                                } else {
     692                                        $searched = '';
     693                                        $search_results = array();
     694                                }
    705695                                ?>
    706                         <?php elseif ( is_wp_error( $search_results ) ) : ?>
    707                                 <li><?php echo $search_results->get_error_message(); ?></li>
    708                         <?php elseif ( ! empty( $searched ) ) : ?>
    709                                 <li><?php _e('No results found.'); ?></li>
    710                         <?php endif; ?>
    711                         </ul>
    712                 </div><!-- /.tabs-panel -->
     696                                <p class="quick-search-wrap">
     697                                        <input type="search" class="quick-search input-with-default-title" title="<?php esc_attr_e('Search'); ?>" value="<?php echo $searched; ?>" name="quick-search-posttype-<?php echo $post_type_name; ?>" />
     698                                        <span class="spinner"></span>
     699                                        <?php submit_button( __( 'Search' ), 'button-small quick-search-submit button-secondary hide-if-js', 'submit', false, array( 'id' => 'submit-quick-search-posttype-' . $post_type_name ) ); ?>
     700                                </p>
    713701
    714                 <div id="<?php echo $post_type_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php
    715                         echo ( 'all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
    716                 ?>">
    717                         <?php if ( ! empty( $page_links ) ) : ?>
    718                                 <div class="add-menu-item-pagelinks">
    719                                         <?php echo $page_links; ?>
    720                                 </div>
    721                         <?php endif; ?>
    722                         <ul id="<?php echo $post_type_name; ?>checklist" data-wp-lists="list:<?php echo $post_type_name?>" class="categorychecklist form-no-clear">
    723                                 <?php
    724                                 $args['walker'] = $walker;
     702                                <ul id="<?php echo $post_type_name; ?>-search-checklist" data-wp-lists="list:<?php echo $post_type_name?>" class="categorychecklist form-no-clear">
     703                                <?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?>
     704                                        <?php
     705                                        $args['walker'] = $walker;
     706                                        echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $search_results), 0, (object) $args );
     707                                        ?>
     708                                <?php elseif ( is_wp_error( $search_results ) ) : ?>
     709                                        <li><?php echo $search_results->get_error_message(); ?></li>
     710                                <?php elseif ( ! empty( $searched ) ) : ?>
     711                                        <li><?php _e('No results found.'); ?></li>
     712                                <?php endif; ?>
     713                                </ul>
     714                        </div><!-- /.tabs-panel -->
    725715
    726                                 // if we're dealing with pages, let's put a checkbox for the front page at the top of the list
    727                                 if ( 'page' == $post_type_name ) {
    728                                         $front_page = 'page' == get_option('show_on_front') ? (int) get_option( 'page_on_front' ) : 0;
    729                                         if ( ! empty( $front_page ) ) {
    730                                                 $front_page_obj = get_post( $front_page );
    731                                                 $front_page_obj->front_or_home = true;
    732                                                 array_unshift( $posts, $front_page_obj );
    733                                         } else {
    734                                                 $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1;
    735                                                 array_unshift( $posts, (object) array(
    736                                                         'front_or_home' => true,
    737                                                         'ID' => 0,
    738                                                         'object_id' => $_nav_menu_placeholder,
    739                                                         'post_content' => '',
    740                                                         'post_excerpt' => '',
    741                                                         'post_parent' => '',
    742                                                         'post_title' => _x('Home', 'nav menu home label'),
    743                                                         'post_type' => 'nav_menu_item',
    744                                                         'type' => 'custom',
    745                                                         'url' => home_url('/'),
    746                                                 ) );
     716                        <div id="<?php echo $post_type_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php
     717                                echo ( 'all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
     718                        ?>">
     719                                <?php if ( ! empty( $page_links ) ) : ?>
     720                                        <div class="add-menu-item-pagelinks">
     721                                                <?php echo $page_links; ?>
     722                                        </div>
     723                                <?php endif; ?>
     724                                <ul id="<?php echo $post_type_name; ?>checklist" data-wp-lists="list:<?php echo $post_type_name?>" class="categorychecklist form-no-clear">
     725                                        <?php
     726                                        $args['walker'] = $walker;
     727
     728                                        // if we're dealing with pages, let's put a checkbox for the front page at the top of the list
     729                                        if ( 'page' == $post_type_name ) {
     730                                                $front_page = 'page' == get_option('show_on_front') ? (int) get_option( 'page_on_front' ) : 0;
     731                                                if ( ! empty( $front_page ) ) {
     732                                                        $front_page_obj = get_post( $front_page );
     733                                                        $front_page_obj->front_or_home = true;
     734                                                        array_unshift( $posts, $front_page_obj );
     735                                                } else {
     736                                                        $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1;
     737                                                        array_unshift( $posts, (object) array(
     738                                                                'front_or_home' => true,
     739                                                                'ID' => 0,
     740                                                                'object_id' => $_nav_menu_placeholder,
     741                                                                'post_content' => '',
     742                                                                'post_excerpt' => '',
     743                                                                'post_parent' => '',
     744                                                                'post_title' => _x('Home', 'nav menu home label'),
     745                                                                'post_type' => 'nav_menu_item',
     746                                                                'type' => 'custom',
     747                                                                'url' => home_url('/'),
     748                                                        ) );
     749                                                }
    747750                                        }
    748                                 }
    749751
    750                                 $posts = apply_filters( 'nav_menu_items_'.$post_type_name, $posts, $args, $post_type );
    751                                 $checkbox_items = walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $posts), 0, (object) $args );
     752                                        $posts = apply_filters( 'nav_menu_items_'.$post_type_name, $posts, $args, $post_type );
     753                                        $checkbox_items = walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $posts), 0, (object) $args );
    752754
    753                                 if ( 'all' == $current_tab && ! empty( $_REQUEST['selectall'] ) ) {
    754                                         $checkbox_items = preg_replace('/(type=(.)checkbox(\2))/', '$1 checked=$2checked$2', $checkbox_items);
     755                                        if ( 'all' == $current_tab && ! empty( $_REQUEST['selectall'] ) ) {
     756                                                $checkbox_items = preg_replace('/(type=(.)checkbox(\2))/', '$1 checked=$2checked$2', $checkbox_items);
    755757
    756                                 }
     758                                        }
    757759
    758                                 echo $checkbox_items;
    759                                 ?>
    760                         </ul>
    761                         <?php if ( ! empty( $page_links ) ) : ?>
    762                                 <div class="add-menu-item-pagelinks">
    763                                         <?php echo $page_links; ?>
    764                                 </div>
    765                         <?php endif; ?>
    766                 </div><!-- /.tabs-panel -->
     760                                        echo $checkbox_items;
     761                                        ?>
     762                                </ul>
     763                                <?php if ( ! empty( $page_links ) ) : ?>
     764                                        <div class="add-menu-item-pagelinks">
     765                                                <?php echo $page_links; ?>
     766                                        </div>
     767                                <?php endif; ?>
     768                        </div><!-- /.tabs-panel -->
    767769
    768                 <p class="button-controls">
    769                         <span class="list-controls">
    770                                 <a href="<?php
    771                                         echo esc_url(add_query_arg(
    772                                                 array(
    773                                                         $post_type_name . '-tab' => 'all',
    774                                                         'selectall' => 1,
    775                                                 ),
    776                                                 remove_query_arg($removed_args)
    777                                         ));
    778                                 ?>#posttype-<?php echo $post_type_name; ?>" class="select-all"><?php _e('Select All'); ?></a>
    779                         </span>
     770                        <p class="button-controls">
     771                                <span class="list-controls">
     772                                        <a href="<?php
     773                                                echo esc_url(add_query_arg(
     774                                                        array(
     775                                                                $post_type_name . '-tab' => 'all',
     776                                                                'selectall' => 1,
     777                                                        ),
     778                                                        remove_query_arg($removed_args)
     779                                                ));
     780                                        ?>#posttype-<?php echo $post_type_name; ?>" class="select-all"><?php _e('Select All'); ?></a>
     781                                </span>
    780782
    781                         <span class="add-to-menu">
    782                                 <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-post-type-menu-item" id="submit-posttype-<?php echo $post_type_name; ?>" />
    783                                 <span class="spinner"></span>
    784                         </span>
    785                 </p>
     783                                <span class="add-to-menu">
     784                                        <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-post-type-menu-item" id="submit-posttype-<?php echo $post_type_name; ?>" />
     785                                        <span class="spinner"></span>
     786                                </span>
     787                        </p>
    786788
    787         </div><!-- /.posttypediv -->
     789                </div><!-- /.posttypediv -->
     790        </li>
    788791        <?php
    789792}
    790793
     
    796799 * @param string $object Not used.
    797800 * @param string $taxonomy The taxonomy object.
    798801 */
    799 function wp_nav_menu_item_taxonomy_meta_box( $object, $taxonomy ) {
     802function wp_nav_menu_item_taxonomy_meta_box( $taxonomy ) {
    800803        global $nav_menu_selected_id;
    801         $taxonomy_name = $taxonomy['args']->name;
     804        $taxonomy_name = $taxonomy->name;
    802805
    803806        // paginate browsing for large numbers of objects
    804807        $per_page = 50;
     
    820823
    821824        $terms = get_terms( $taxonomy_name, $args );
    822825
    823         if ( ! $terms || is_wp_error($terms) ) {
     826        if ( is_wp_error($terms) ) {
    824827                echo '<p>' . __( 'No items.' ) . '</p>';
    825828                return;
    826829        }
     
    869872        );
    870873
    871874        ?>
    872         <div id="taxonomy-<?php echo $taxonomy_name; ?>" class="taxonomydiv">
    873                 <ul id="taxonomy-<?php echo $taxonomy_name; ?>-tabs" class="taxonomy-tabs add-menu-item-tabs">
    874                         <li <?php echo ( 'most-used' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'most-used', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-pop"><?php _e('Most Used'); ?></a></li>
    875                         <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-all"><?php _e('View All'); ?></a></li>
    876                         <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>"><?php _e('Search'); ?></a></li>
    877                 </ul>
    878 
    879                 <div id="tabs-panel-<?php echo $taxonomy_name; ?>-pop" class="tabs-panel <?php
    880                         echo ( 'most-used' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
    881                 ?>">
    882                         <ul id="<?php echo $taxonomy_name; ?>checklist-pop" class="categorychecklist form-no-clear" >
    883                                 <?php
    884                                 $popular_terms = get_terms( $taxonomy_name, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
    885                                 $args['walker'] = $walker;
    886                                 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $popular_terms), 0, (object) $args );
    887                                 ?>
     875        <li class="control-section accordion-section" id="accordion-section-title_tagline">
     876                <h3 title="" tabindex="0" class="accordion-section-title"><?php echo $taxonomy->labels->name; ?></h3>
     877                <div id="taxonomy-<?php echo $taxonomy_name; ?>" class="taxonomydiv accordion-section-content">
     878                        <ul id="taxonomy-<?php echo $taxonomy_name; ?>-tabs" class="taxonomy-tabs add-menu-item-tabs">
     879                                <li <?php echo ( 'most-used' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'most-used', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-pop"><?php _e('Most Used'); ?></a></li>
     880                                <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-all"><?php _e('View All'); ?></a></li>
     881                                <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>"><?php _e('Search'); ?></a></li>
    888882                        </ul>
    889                 </div><!-- /.tabs-panel -->
    890883
    891                 <div id="tabs-panel-<?php echo $taxonomy_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php
    892                         echo ( 'all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
    893                 ?>">
    894                         <?php if ( ! empty( $page_links ) ) : ?>
    895                                 <div class="add-menu-item-pagelinks">
    896                                         <?php echo $page_links; ?>
    897                                 </div>
    898                         <?php endif; ?>
    899                         <ul id="<?php echo $taxonomy_name; ?>checklist" data-wp-lists="list:<?php echo $taxonomy_name?>" class="categorychecklist form-no-clear">
    900                                 <?php
    901                                 $args['walker'] = $walker;
    902                                 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $terms), 0, (object) $args );
    903                                 ?>
    904                         </ul>
    905                         <?php if ( ! empty( $page_links ) ) : ?>
    906                                 <div class="add-menu-item-pagelinks">
    907                                         <?php echo $page_links; ?>
    908                                 </div>
    909                         <?php endif; ?>
    910                 </div><!-- /.tabs-panel -->
     884                        <div id="tabs-panel-<?php echo $taxonomy_name; ?>-pop" class="tabs-panel <?php
     885                                echo ( 'most-used' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
     886                        ?>">
     887                                <ul id="<?php echo $taxonomy_name; ?>checklist-pop" class="categorychecklist form-no-clear" >
     888                                        <?php
     889                                        $popular_terms = get_terms( $taxonomy_name, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
     890                                        $args['walker'] = $walker;
     891                                        echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $popular_terms), 0, (object) $args );
     892                                        ?>
     893                                </ul>
     894                        </div><!-- /.tabs-panel -->
    911895
    912                 <div class="tabs-panel <?php
    913                         echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
    914                 ?>" id="tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>">
    915                         <?php
    916                         if ( isset( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] ) ) {
    917                                 $searched = esc_attr( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] );
    918                                 $search_results = get_terms( $taxonomy_name, array( 'name__like' => $searched, 'fields' => 'all', 'orderby' => 'count', 'order' => 'DESC', 'hierarchical' => false ) );
    919                         } else {
    920                                 $searched = '';
    921                                 $search_results = array();
    922                         }
    923                         ?>
    924                         <p class="quick-search-wrap">
    925                                 <input type="search" class="quick-search input-with-default-title" title="<?php esc_attr_e('Search'); ?>" value="<?php echo $searched; ?>" name="quick-search-taxonomy-<?php echo $taxonomy_name; ?>" />
    926                                 <span class="spinner"></span>
    927                                 <?php submit_button( __( 'Search' ), 'button-small quick-search-submit button-secondary hide-if-js', 'submit', false, array( 'id' => 'submit-quick-search-taxonomy-' . $taxonomy_name ) ); ?>
    928                         </p>
     896                        <div id="tabs-panel-<?php echo $taxonomy_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php
     897                                echo ( 'all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
     898                        ?>">
     899                                <?php if ( ! empty( $page_links ) ) : ?>
     900                                        <div class="add-menu-item-pagelinks">
     901                                                <?php echo $page_links; ?>
     902                                        </div>
     903                                <?php endif; ?>
     904                                <ul id="<?php echo $taxonomy_name; ?>checklist" data-wp-lists="list:<?php echo $taxonomy_name?>" class="categorychecklist form-no-clear">
     905                                        <?php
     906                                        $args['walker'] = $walker;
     907                                        echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $terms), 0, (object) $args );
     908                                        ?>
     909                                </ul>
     910                                <?php if ( ! empty( $page_links ) ) : ?>
     911                                        <div class="add-menu-item-pagelinks">
     912                                                <?php echo $page_links; ?>
     913                                        </div>
     914                                <?php endif; ?>
     915                        </div><!-- /.tabs-panel -->
    929916
    930                         <ul id="<?php echo $taxonomy_name; ?>-search-checklist" data-wp-lists="list:<?php echo $taxonomy_name?>" class="categorychecklist form-no-clear">
    931                         <?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?>
     917                        <div class="tabs-panel <?php
     918                                echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
     919                        ?>" id="tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>">
    932920                                <?php
    933                                 $args['walker'] = $walker;
    934                                 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $search_results), 0, (object) $args );
     921                                if ( isset( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] ) ) {
     922                                        $searched = esc_attr( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] );
     923                                        $search_results = get_terms( $taxonomy_name, array( 'name__like' => $searched, 'fields' => 'all', 'orderby' => 'count', 'order' => 'DESC', 'hierarchical' => false ) );
     924                                } else {
     925                                        $searched = '';
     926                                        $search_results = array();
     927                                }
    935928                                ?>
    936                         <?php elseif ( is_wp_error( $search_results ) ) : ?>
    937                                 <li><?php echo $search_results->get_error_message(); ?></li>
    938                         <?php elseif ( ! empty( $searched ) ) : ?>
    939                                 <li><?php _e('No results found.'); ?></li>
    940                         <?php endif; ?>
    941                         </ul>
    942                 </div><!-- /.tabs-panel -->
     929                                <p class="quick-search-wrap">
     930                                        <input type="search" class="quick-search input-with-default-title" title="<?php esc_attr_e('Search'); ?>" value="<?php echo $searched; ?>" name="quick-search-taxonomy-<?php echo $taxonomy_name; ?>" />
     931                                        <span class="spinner"></span>
     932                                        <?php submit_button( __( 'Search' ), 'button-small quick-search-submit button-secondary hide-if-js', 'submit', false, array( 'id' => 'submit-quick-search-taxonomy-' . $taxonomy_name ) ); ?>
     933                                </p>
    943934
    944                 <p class="button-controls">
    945                         <span class="list-controls">
    946                                 <a href="<?php
    947                                         echo esc_url(add_query_arg(
    948                                                 array(
    949                                                         $taxonomy_name . '-tab' => 'all',
    950                                                         'selectall' => 1,
    951                                                 ),
    952                                                 remove_query_arg($removed_args)
    953                                         ));
    954                                 ?>#taxonomy-<?php echo $taxonomy_name; ?>" class="select-all"><?php _e('Select All'); ?></a>
    955                         </span>
     935                                <ul id="<?php echo $taxonomy_name; ?>-search-checklist" data-wp-lists="list:<?php echo $taxonomy_name?>" class="categorychecklist form-no-clear">
     936                                <?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?>
     937                                        <?php
     938                                        $args['walker'] = $walker;
     939                                        echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $search_results), 0, (object) $args );
     940                                        ?>
     941                                <?php elseif ( is_wp_error( $search_results ) ) : ?>
     942                                        <li><?php echo $search_results->get_error_message(); ?></li>
     943                                <?php elseif ( ! empty( $searched ) ) : ?>
     944                                        <li><?php _e('No results found.'); ?></li>
     945                                <?php endif; ?>
     946                                </ul>
     947                        </div><!-- /.tabs-panel -->
    956948
    957                         <span class="add-to-menu">
    958                                 <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-taxonomy-menu-item" id="submit-taxonomy-<?php echo $taxonomy_name; ?>" />
    959                                 <span class="spinner"></span>
    960                         </span>
    961                 </p>
     949                        <p class="button-controls">
     950                                <span class="list-controls">
     951                                        <a href="<?php
     952                                                echo esc_url(add_query_arg(
     953                                                        array(
     954                                                                $taxonomy_name . '-tab' => 'all',
     955                                                                'selectall' => 1,
     956                                                        ),
     957                                                        remove_query_arg($removed_args)
     958                                                ));
     959                                        ?>#taxonomy-<?php echo $taxonomy_name; ?>" class="select-all"><?php _e('Select All'); ?></a>
     960                                </span>
    962961
    963         </div><!-- /.taxonomydiv -->
     962                                <span class="add-to-menu">
     963                                        <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-taxonomy-menu-item" id="submit-taxonomy-<?php echo $taxonomy_name; ?>" />
     964                                        <span class="spinner"></span>
     965                                </span>
     966                        </p>
     967
     968                </div><!-- /.taxonomydiv -->
     969        </li>
    964970        <?php
    965971}
    966972
  • wp-admin/js/nav-menu.js

     
    4545                        if( api.menuList.length ) // If no menu, we're in the + tab.
    4646                                this.initSortables();
    4747
    48                         this.initToggles();
    49 
    5048                        this.initTabManager();
    5149                },
    5250
     
    223221                        });
    224222                },
    225223
    226                 initToggles : function() {
    227                         // init postboxes
    228                         postboxes.add_postbox_toggles('nav-menus');
    229 
    230                         // adjust columns functions for menus UI
    231                         columns.useCheckboxesForHidden();
    232                         columns.checked = function(field) {
    233                                 $('.field-' + field).removeClass('hidden-field');
    234                         }
    235                         columns.unchecked = function(field) {
    236                                 $('.field-' + field).addClass('hidden-field');
    237                         }
    238                         // hide fields
    239                         api.menuList.hideAdvancedMenuItemFields();
    240                 },
    241 
    242224                initSortables : function() {
    243225                        var currentDepth = 0, originalDepth, minDepth, maxDepth,
    244226                                prev, next, prevBottom, nextThreshold, helperHeight, transport,
  • wp-admin/nav-menus.php

     
    2323        wp_die( __( 'Cheatin&#8217; uh?' ) );
    2424
    2525wp_enqueue_script( 'nav-menu' );
     26wp_enqueue_script( 'accordion' );
    2627
    2728if ( wp_is_mobile() )
    2829        wp_enqueue_script( 'jquery-touch-punch' );
     
    428429
    429430add_filter('admin_body_class', 'wp_nav_menu_max_depth');
    430431
    431 wp_nav_menu_setup();
    432432wp_initial_nav_menu_meta_boxes();
    433433
    434434if ( ! current_theme_supports( 'menus' ) && ! wp_get_nav_menus() )
     
    473473                        <input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />
    474474                        <input type="hidden" name="action" value="add-menu-item" />
    475475                        <?php wp_nonce_field( 'add-menu_item', 'menu-settings-column-nonce' ); ?>
    476                         <?php do_meta_boxes( 'nav-menus', 'side', null ); ?>
     476                        <div id="side-sortables" class="accordion-container">
     477                                <ul class="outer-border">
     478                                        <?php wp_nav_menu_setup(); ?>
     479                                </ul>
     480                        </div>
    477481                </form>
    478482
    479483        </div><!-- /#menu-settings-column -->
  • wp-admin/css/wp-admin.css

     
    67046704
    67056705/* nav-menu */
    67066706
     6707#nav-menu-meta ul.outer-border {
     6708        border: 1px solid #eeeeee;
     6709}
     6710
     6711.accordion-section ul.category-tabs,
     6712.accordion-section ul.add-menu-item-tabs,
     6713.accordion-section ul.wp-tab-bar {
     6714        margin: 0;
     6715}
     6716
     6717.accordion-section .categorychecklist {
     6718        margin: 13px 0;
     6719}
     6720
     6721#nav-menu-meta .accordion-section-content {
     6722        padding: 18px 13px;
     6723}
     6724
     6725#nav-menu-meta .button-controls {
     6726        margin-bottom: 0;
     6727}
     6728
    67076729#nav-menus-frame {
    67086730        margin-left: 300px;
    67096731}
     
    68706892}
    68716893
    68726894/* Add Menu Item Boxes */
    6873 .postbox .howto input {
     6895.postbox .howto input,
     6896.accordion-container .howto input {
    68746897        width: 180px;
    68756898        float: right;
    68766899}
     
    68796902        width: 200px;
    68806903}
    68816904
     6905.customlinkdiv p {
     6906        margin-top: 0
     6907}
     6908
    68826909#nav-menu-theme-locations .howto select {
    68836910        width: 100%;
    68846911}