Make WordPress Core


Ignore:
Timestamp:
06/11/2010 05:19:36 AM (15 years ago)
Author:
nacin
Message:

Horizontal scrolling/resizing fixes for nav menu UI. Also some RTL fixes. props koopersmith, see #13525

File:
1 edited

Legend:

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

    r15193 r15214  
    430430    $nav_menus[$key]->truncated_name = $_nav_menu->truncated_name;
    431431}
     432
     433// Ensure the user will be able to scroll horizontally
     434// by adding a class for the max menu depth.
     435global $_wp_nav_menu_max_depth;
     436$_wp_nav_menu_max_depth = 0;
     437
     438// Calling wp_get_nav_menu_to_edit generates $_wp_nav_menu_max_depth
     439if ( is_nav_menu( $nav_menu_selected_id ) )
     440    $edit_markup = wp_get_nav_menu_to_edit( $nav_menu_selected_id  );
     441
     442function wp_nav_menu_max_depth() {
     443    global $_wp_nav_menu_max_depth;
     444    return "menu-max-depth-$_wp_nav_menu_max_depth";
     445}
     446
     447add_action('admin_body_class','wp_nav_menu_max_depth');
    432448
    433449wp_nav_menu_setup();
     
    565581                        <div id="post-body-content">
    566582                            <?php
    567                             if ( is_nav_menu( $nav_menu_selected_id ) ) :
    568                                 $edit_markup = wp_get_nav_menu_to_edit( $nav_menu_selected_id  );
    569                                 if ( ! is_wp_error( $edit_markup ) ) :
     583                            if ( isset( $edit_markup ) ) {
     584                                if ( ! is_wp_error( $edit_markup ) )
    570585                                    echo $edit_markup;
    571                                 endif;
    572                             elseif ( empty( $nav_menu_selected_id ) ) :
     586                            } else if ( empty( $nav_menu_selected_id ) ) {
    573587                                echo '<div class="post-body-plain">';
    574588                                echo '<p>' . __('To create a custom menu, give it a name above and click Create Menu. Then choose items like pages, categories or custom links from the left column to add to this menu.') . '</p>';
     
    576590                                echo '<p>' . __('When you have finished building your custom menu, make sure you click the Save Menu button.') . '</p>';
    577591                                echo '</div>';
    578                             endif;
     592                            }
    579593                            ?>
    580594                        </div><!-- /#post-body-content -->
Note: See TracChangeset for help on using the changeset viewer.