Make WordPress Core


Ignore:
Timestamp:
02/28/2010 08:00:49 PM (16 years ago)
Author:
ryan
Message:

Menu enhancements. Props ptahdunbar. fixes #11817

File:
1 edited

Legend:

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

    r13473 r13512  
    4343$updated = false;
    4444$advanced_option_descriptions = 'no';
    45 
    46 // Get all menu link items
    47 $available_links = new WP_Query( array( 'post_status' => 'any', 'post_type' => 'nav_menu_item', 'meta_key' => 'menu_type', 'meta_value' => 'custom' ) );
    4845
    4946// Check which menu is selected and if menu is in edit already
     
    128125    // Loop through all POST variables
    129126    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;
    133130        $custom_title = isset( $_POST['item-title'.$k] )?  $_POST['item-title'.$k] : '';
    134131        $custom_linkurl = ( isset( $_POST['item-url'.$k] ) && 'custom' == $_POST['linktype'.$k] ) ? $_POST['item-url'.$k] : '';
    135132        $custom_description = isset( $_POST['item-description'.$k] )? $_POST['item-description'.$k] : '';
     133       
    136134        // 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';
    140137        $custom_anchor_title  = isset( $_POST['item-attr-title'.$k] )? $_POST['item-attr-title'.$k] : $custom_title;
    141138        $new_window = isset( $_POST['item-target'.$k] )? $_POST['item-target'.$k] : 0;
     
    210207                                <input type="hidden" name="li-count" id="li-count" value="0" />
    211208                                <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">
    214209                                <?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' ) );
    218212                                ?>
    219                                 </ul><!-- /#menu-->
    220213                               
    221214                                <div id="queue" class="hide">
     
    266259                            </p>
    267260                           
    268                     <?php if ( $available_links->posts ) : ?>
    269261                            <p class="button-controls">
    270262                                <a class="show-all button"><?php _e('View All'); ?></a>
     
    274266                                <div class="list-container">
    275267                                    <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' ); ?>
    290269                                    </ul>
    291270                                </div><!-- /.list-container-->
    292271                            </div><!-- /#available-links-->
    293                     <?php endif; ?>
    294272                            <p class="add-to-menu">
    295273                                <a class="button"><?php _e('Add to Menu'); ?></a>
     
    326304                                    jQuery('#add-pages .quick-search').result(function(event, data, formatted) {
    327305                                        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');
    329307                                        jQuery('#add-pages .show-all').hide();
    330308                                        jQuery('#add-pages .hide-all').show();
     
    345323                                <div class="list-container">
    346324                                    <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' ); ?>
    348326                                    </ul>
    349327                                </div><!-- /.list-container-->
     
    388366                                    jQuery('#add-categories .quick-search').result(function(event, data, formatted) {
    389367                                        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');
    391369                                        jQuery('#add-categories .show-all').hide();
    392370                                        jQuery('#add-categories .hide-all').show();
Note: See TracChangeset for help on using the changeset viewer.