From 81ae08cf40a4e9f1b31b976da5a828ece24829bf Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sun, 9 Oct 2016 23:40:53 +0000 Subject: [PATCH] Customize: Show Pages section first and pre-expanded in list of available nav menu items. Props ryankienstra, westonruter. Fixes #36984. git-svn-id: https://develop.svn.wordpress.org/trunk@38767 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/customize-nav-menus.js | 2 + .../class-wp-customize-nav-menus.php | 152 +++++++++++------- 2 files changed, 99 insertions(+), 55 deletions(-) diff --git a/src/wp-admin/js/customize-nav-menus.js b/src/wp-admin/js/customize-nav-menus.js index 71052a1397..d8ab2eb254 100644 --- a/src/wp-admin/js/customize-nav-menus.js +++ b/src/wp-admin/js/customize-nav-menus.js @@ -397,6 +397,8 @@ } self.pages[ type + ':' + object ] = -1; return; + } else if ( 'page' === object ) { + availableMenuItemContainer.find( '.accordion-section-title > button' ).click(); } items = new api.Menus.AvailableItemCollection( items ); // @todo Why is this collection created and then thrown away? self.collection.add( items.models ); diff --git a/src/wp-includes/class-wp-customize-nav-menus.php b/src/wp-includes/class-wp-customize-nav-menus.php index f102cd80f0..0bc95da58a 100644 --- a/src/wp-includes/class-wp-customize-nav-menus.php +++ b/src/wp-includes/class-wp-customize-nav-menus.php @@ -895,70 +895,112 @@ final class WP_Customize_Nav_Menus { -
- -
- - - -

- - - - -

-
-
available_item_types(); + $page_item_type = null; + foreach ( $item_types as $i => $item_type ) { + if ( isset( $item_type['object'] ) && 'page' === $item_type['object'] ) { + $page_item_type = $item_type; + unset( $item_types[ $i ] ); + } + } + + if ( $page_item_type ) { + $this->print_post_type_container( $page_item_type ); + } + $this->print_custom_links_available_menu_item(); // Containers for per-post-type item browsing; items are added with JS. - foreach ( $this->available_item_types() as $available_item_type ) { - $id = sprintf( 'available-menu-items-%s-%s', $available_item_type['type'], $available_item_type['object'] ); - ?> -
- -
- - - cap->create_posts ) && current_user_can( $post_type_obj->cap->publish_posts ) ) : ?> -
- - -
- - -
    -
    -
    - print_post_type_container( $item_type ); } ?> +
    + +
    + + + cap->create_posts ) && current_user_can( $post_type_obj->cap->publish_posts ) ) : ?> +
    + + +
    + + +
      +
      +
      + +
      + +
      + + + +

      + + + + +

      +
      +
      +