WordPress.org

Make WordPress Core

Changeset 14744


Ignore:
Timestamp:
05/19/10 14:34:29 (5 years ago)
Author:
ryan
Message:

Order pages in menu box by menu_order, title. Props filosofo. see #13329

File:
1 edited

Legend:

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

    r14738 r14744  
    538538    $num_pages = $get_posts->max_num_pages; 
    539539 
    540     if ( isset( $get_posts->found_posts ) && ( $get_posts->found_posts > $get_posts->post_count ) ) { 
    541         // somewhat like display_page_row(), let's make sure ancestors show up on paged display 
    542         $parent_ids = array(); 
    543         $child_ids = array(); 
    544         foreach( (array) $posts as $post ) { 
    545             $parent_ids[] = (int) $post->post_parent; 
    546             $child_ids[] = (int) $post->ID; 
    547         } 
    548         $parent_ids = array_unique($parent_ids); 
    549         $child_ids = array_unique($child_ids); 
    550  
    551         $missing_parents = array(); 
    552         do { 
    553             foreach( (array) $missing_parents as $missing_parent_id ) { 
    554                 $missing_parent = get_post($missing_parent_id); 
    555                 $posts[] = $missing_parent; 
    556                 $child_ids[] = $missing_parent_id; 
    557                 $parent_ids[] = $missing_parent->post_parent; 
    558             } 
    559  
    560             $missing_parents = array_filter( array_diff( array_unique( $parent_ids ), array_unique( $child_ids ) ) ); 
    561  
    562         } while( 0 < count( $missing_parents ) ); 
    563  
    564     } 
    565  
    566540    $page_links = paginate_links( array( 
    567541        'base' => add_query_arg( 
     
    937911        if ( 'page' == $object->name ) { 
    938912            $object->_default_query = array( 
    939                 'orderby' => 'post_date', 
    940                 'order' => 'DESC', 
     913                'orderby' => 'menu_order title', 
    941914                'post_status' => 'publish', 
    942915            ); 
Note: See TracChangeset for help on using the changeset viewer.