From 628d7b8286dfa8031852d38fc7c639f4629009e8 Mon Sep 17 00:00:00 2001 From: nacin Date: Fri, 21 May 2010 23:32:45 +0000 Subject: [PATCH] Most Recent tab for nav menu meta boxes for post types. props filosofo, see #13217. git-svn-id: http://svn.automattic.com/wordpress/trunk@14797 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/nav-menu.php | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/wp-admin/includes/nav-menu.php b/wp-admin/includes/nav-menu.php index 4bba6dd7f8..71c496157c 100644 --- a/wp-admin/includes/nav-menu.php +++ b/wp-admin/includes/nav-menu.php @@ -556,7 +556,9 @@ function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) { if ( !$posts ) $error = '
  • '. $post_type['args']->labels->not_found .'
  • '; - $current_tab = 'all'; + $walker = new Walker_Nav_Menu_Checklist; + + $current_tab = 'most-recent'; if ( isset( $_REQUEST[$post_type_name . '-tab'] ) && in_array( $_REQUEST[$post_type_name . '-tab'], array('all', 'search') ) ) { $current_tab = $_REQUEST[$post_type_name . '-tab']; } @@ -577,10 +579,24 @@ function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) { ?>
    +
    +
      + 'post_date', 'order' => 'DESC', 'showposts' => 15 ) ); + $most_recent = $get_posts->query( $recent_args ); + $args['walker'] = $walker; + echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $most_recent), 0, (object) $args ); + ?> +
    +
    +
    @@ -907,7 +921,6 @@ function _wp_nav_menu_meta_box_object( $object = null ) { if ( 'attachment' == $object->name ) return false; - // pages should show most recent if ( 'page' == $object->name ) { $object->_default_query = array( 'orderby' => 'menu_order title',