WordPress.org

Make WordPress Core

Changeset 15045


Ignore:
Timestamp:
05/28/2010 08:36:57 PM (10 years ago)
Author:
nacin
Message:

Make nav menu meta box tab ordering consistent across post types and taxonomies. see #13525.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/nav-menu.php

    r15010 r15045  
    784784        <ul id="taxonomy-<?php echo $taxonomy_name; ?>-tabs" class="taxonomy-tabs add-menu-item-tabs">
    785785            <li <?php echo ( 'most-used' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php 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>
     786            <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php 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>
    786787            <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php 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>
    787             <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php 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>
    788788        </ul>
    789789
     
    797797                echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $popular_terms), 0, (object) $args );
    798798                ?>
    799             </ul>
    800         </div><!-- /.tabs-panel -->
    801 
    802         <div class="tabs-panel <?php
    803             echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
    804         ?>" id="tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>">
    805             <?php
    806             if ( isset( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] ) ) {
    807                 $searched = esc_attr( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] );
    808                 $search_results = get_terms( $taxonomy_name, array( 'name__like' => $searched, 'fields' => 'all', 'orderby' => 'count', 'order' => 'DESC', 'hierarchical' => false ) );
    809             } else {
    810                 $searched = '';
    811                 $search_results = array();
    812             }
    813             ?>
    814             <p class="quick-search-wrap">
    815                 <input type="text" class="quick-search regular-text input-with-default-title" title="<?php esc_attr_e('Search'); ?>" value="<?php echo $searched; ?>" name="quick-search-taxonomy-<?php echo $taxonomy_name; ?>" />
    816                 <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
    817                 <input type="submit" class="quick-search-submit button-secondary hide-if-js" value="<?php esc_attr_e('Search'); ?>" />
    818             </p>
    819 
    820             <ul id="<?php echo $taxonomy_name; ?>-search-checklist" class="list:<?php echo $taxonomy_name?> categorychecklist form-no-clear">
    821             <?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?>
    822                 <?php
    823                 $args['walker'] = $walker;
    824                 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $search_results), 0, (object) $args );
    825                 ?>
    826             <?php elseif ( is_wp_error( $search_results ) ) : ?>
    827                 <li><?php echo $search_results->get_error_message(); ?></li>
    828             <?php elseif ( ! empty( $searched ) ) : ?>
    829                 <li><?php _e('No results found.'); ?></li>
    830             <?php endif; ?>
    831799            </ul>
    832800        </div><!-- /.tabs-panel -->
     
    853821        </div><!-- /.tabs-panel -->
    854822
     823        <div class="tabs-panel <?php
     824            echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
     825        ?>" id="tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>">
     826            <?php
     827            if ( isset( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] ) ) {
     828                $searched = esc_attr( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] );
     829                $search_results = get_terms( $taxonomy_name, array( 'name__like' => $searched, 'fields' => 'all', 'orderby' => 'count', 'order' => 'DESC', 'hierarchical' => false ) );
     830            } else {
     831                $searched = '';
     832                $search_results = array();
     833            }
     834            ?>
     835            <p class="quick-search-wrap">
     836                <input type="text" class="quick-search regular-text input-with-default-title" title="<?php esc_attr_e('Search'); ?>" value="<?php echo $searched; ?>" name="quick-search-taxonomy-<?php echo $taxonomy_name; ?>" />
     837                <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
     838                <input type="submit" class="quick-search-submit button-secondary hide-if-js" value="<?php esc_attr_e('Search'); ?>" />
     839            </p>
     840
     841            <ul id="<?php echo $taxonomy_name; ?>-search-checklist" class="list:<?php echo $taxonomy_name?> categorychecklist form-no-clear">
     842            <?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?>
     843                <?php
     844                $args['walker'] = $walker;
     845                echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $search_results), 0, (object) $args );
     846                ?>
     847            <?php elseif ( is_wp_error( $search_results ) ) : ?>
     848                <li><?php echo $search_results->get_error_message(); ?></li>
     849            <?php elseif ( ! empty( $searched ) ) : ?>
     850                <li><?php _e('No results found.'); ?></li>
     851            <?php endif; ?>
     852            </ul>
     853        </div><!-- /.tabs-panel -->
     854
    855855        <p class="button-controls">
    856856            <span class="list-controls">
Note: See TracChangeset for help on using the changeset viewer.