Ticket #13217: most-recent-posttype-panel.13217.diff
File most-recent-posttype-panel.13217.diff, 3.9 KB (added by , 14 years ago) |
---|
-
wp-admin/includes/nav-menu.php
556 556 if ( !$posts ) 557 557 $error = '<li id="error">'. $post_type['args']->labels->not_found .'</li>'; 558 558 559 $current_tab = 'all'; 559 $walker = new Walker_Nav_Menu_Checklist; 560 561 $current_tab = 'most-recent'; 560 562 if ( isset( $_REQUEST[$post_type_name . '-tab'] ) && in_array( $_REQUEST[$post_type_name . '-tab'], array('all', 'search') ) ) { 561 563 $current_tab = $_REQUEST[$post_type_name . '-tab']; 562 564 } … … 577 579 ?> 578 580 <div id="posttype-<?php echo $post_type_name; ?>" class="posttypediv"> 579 581 <ul id="posttype-<?php echo $post_type_name; ?>-tabs" class="posttype-tabs add-menu-item-tabs"> 582 <li <?php echo ( 'most-recent' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php 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> 580 583 <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php 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> 581 584 <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php 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> 582 585 </ul> 583 586 587 <div id="tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent" class="tabs-panel <?php 588 echo ( 'most-recent' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); 589 ?>"> 590 <ul id="<?php echo $post_type_name; ?>checklist-most-recent" class="categorychecklist form-no-clear"> 591 <?php 592 $recent_args = array_merge( $args, array( 'orderby' => 'post_date', 'order' => 'DESC', 'showposts' => 15 ) ); 593 $most_recent = $get_posts->query( $recent_args ); 594 $args['walker'] = $walker; 595 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $most_recent), 0, (object) $args ); 596 ?> 597 </ul> 598 </div><!-- /.tabs-panel --> 599 584 600 <div class="tabs-panel <?php 585 601 echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); 586 602 ?>" id="tabs-panel-posttype-<?php echo $post_type_name; ?>-search"> … … 602 618 <ul id="<?php echo $post_type_name; ?>-search-checklist" class="list:<?php echo $post_type_name?> categorychecklist form-no-clear"> 603 619 <?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?> 604 620 <?php 605 $args['walker'] = new Walker_Nav_Menu_Checklist;621 $args['walker'] = $walker; 606 622 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $search_results), 0, (object) $args ); 607 623 ?> 608 624 <?php elseif ( is_wp_error( $search_results ) ) : ?> … … 622 638 </div> 623 639 <ul id="<?php echo $post_type_name; ?>checklist" class="list:<?php echo $post_type_name?> categorychecklist form-no-clear"> 624 640 <?php 625 $args['walker'] = new Walker_Nav_Menu_Checklist;641 $args['walker'] = $walker; 626 642 $checkbox_items = walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $posts), 0, (object) $args ); 627 643 628 644 if ( 'all' == $current_tab && ! empty( $_REQUEST['selectall'] ) ) { … … 751 767 $args['walker'] = $walker; 752 768 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $popular_terms), 0, (object) $args ); 753 769 ?> 754 <?php755 ?>756 770 </ul> 757 771 </div><!-- /.tabs-panel --> 758 772 … … 907 921 if ( 'attachment' == $object->name ) 908 922 return false; 909 923 910 // pages should show most recent911 924 if ( 'page' == $object->name ) { 912 925 $object->_default_query = array( 913 926 'orderby' => 'menu_order title',