Make WordPress Core


Ignore:
Timestamp:
03/15/2013 01:16:38 PM (12 years ago)
Author:
markjaquith
Message:

Turn the Nav Menu meta boxes into an accordion. Less sprawling and overwhelming.

  • Registration stays the same — they're meta boxes
  • Call do_accordion_sections() instead of do_meta_boxes() and they render as an accordion

props DrewAPicture, lessbloat, jkudish. fixes #23450. see #23449

File:
1 edited

Legend:

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

    r23441 r23707  
    388388    // Register meta boxes
    389389    wp_nav_menu_post_type_meta_boxes();
    390     add_meta_box( 'add-custom-links', __( 'Add Links' ), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
     390    add_meta_box( 'add-custom-links', __( 'Links' ), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
    391391    wp_nav_menu_taxonomy_meta_boxes();
    392392
    393393    // Register advanced menu items (columns)
    394     add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns');
     394    add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns' );
    395395
    396396    // If first time editing, disable advanced items by default.
     
    448448        if ( $post_type ) {
    449449            $id = $post_type->name;
    450             add_meta_box( "add-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', 'default', $post_type );
     450            // give pages a higher priority
     451            $priority = ( 'page' == $post_type->name ? 'core' : 'default' );
     452            add_meta_box( "add-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', $priority, $post_type );
    451453        }
    452454    }
     
    566568    ?>
    567569    <div class="customlinkdiv" id="customlinkdiv">
    568 
    569             <input type="hidden" value="custom" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-type]" />
    570             <p id="menu-item-url-wrap">
    571                 <label class="howto" for="custom-menu-item-url">
    572                     <span><?php _e('URL'); ?></span>
    573                     <input id="custom-menu-item-url" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-url]" type="text" class="code menu-item-textbox" value="http://" />
    574                 </label>
    575             </p>
    576 
    577             <p id="menu-item-name-wrap">
    578                 <label class="howto" for="custom-menu-item-name">
    579                     <span><?php _e( 'Link Text' ); ?></span>
    580                     <input id="custom-menu-item-name" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-title]" type="text" class="regular-text menu-item-textbox input-with-default-title" title="<?php esc_attr_e('Menu Item'); ?>" />
    581                 </label>
    582             </p>
     570        <input type="hidden" value="custom" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-type]" />
     571        <p id="menu-item-url-wrap">
     572            <label class="howto" for="custom-menu-item-url">
     573                <span><?php _e('URL'); ?></span>
     574                <input id="custom-menu-item-url" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-url]" type="text" class="code menu-item-textbox" value="http://" />
     575            </label>
     576        </p>
     577
     578        <p id="menu-item-name-wrap">
     579            <label class="howto" for="custom-menu-item-name">
     580                <span><?php _e( 'Link Text' ); ?></span>
     581                <input id="custom-menu-item-name" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-title]" type="text" class="regular-text menu-item-textbox input-with-default-title" title="<?php esc_attr_e('Menu Item'); ?>" />
     582            </label>
     583        </p>
    583584
    584585        <p class="button-controls">
     
    684685    <div id="posttype-<?php echo $post_type_name; ?>" class="posttypediv">
    685686        <ul id="posttype-<?php echo $post_type_name; ?>-tabs" class="posttype-tabs add-menu-item-tabs">
    686             <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>
    687             <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>
    688             <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>
    689         </ul>
     687            <li <?php echo ( 'most-recent' == $current_tab ? ' class="tabs"' : '' ); ?>>
     688                <a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-most-recent" 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">
     689                    <?php _e( 'Most Recent' ); ?>
     690                </a>
     691            </li>
     692            <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>>
     693                <a class="nav-tab-link" data-type="<?php echo esc_attr( $post_type_name ); ?>-all" 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">
     694                    <?php _e( 'View All' ); ?>
     695                </a>
     696            </li>
     697            <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>>
     698                <a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-search" 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">
     699                    <?php _e( 'Search'); ?>
     700                </a>
     701            </li>
     702        </ul><!-- .posttype-tabs -->
    690703
    691704        <div id="tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent" class="tabs-panel <?php
     
    894907    <div id="taxonomy-<?php echo $taxonomy_name; ?>" class="taxonomydiv">
    895908        <ul id="taxonomy-<?php echo $taxonomy_name; ?>-tabs" class="taxonomy-tabs add-menu-item-tabs">
    896             <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>
    897             <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>
    898             <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>
    899         </ul>
     909            <li <?php echo ( 'most-used' == $current_tab ? ' class="tabs"' : '' ); ?>>
     910                <a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-pop" 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">
     911                    <?php _e( 'Most Used' ); ?>
     912                </a>
     913            </li>
     914            <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>>
     915                <a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-all" 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">
     916                    <?php _e( 'View All' ); ?>
     917                </a>
     918            </li>
     919            <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>>
     920                <a class="nav-tab-link" data-type="tabs-panel-search-taxonomy-<?php echo esc_attr( $taxonomy_name ); ?>" 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; ?>">
     921                    <?php _e( 'Search' ); ?>
     922                </a>
     923            </li>
     924        </ul><!-- .taxonomy-tabs -->
    900925
    901926        <div id="tabs-panel-<?php echo $taxonomy_name; ?>-pop" class="tabs-panel <?php
Note: See TracChangeset for help on using the changeset viewer.