Make WordPress Core


Ignore:
Timestamp:
10/01/2015 02:09:41 AM (10 years ago)
Author:
wonderboymusic
Message:

Post List Table: Ensure that edit.php with no query string produces the proper markup and links in the date column header.

Add 2 methods to WP_List_Table, ->get_orderby() and ->get_order(). Override the methods in WP_Posts_List_Table.

WP_Posts_List_Table calls wp_edit_posts_query() in ->prepare_items() which is a wrapper for wp(). As such, we can obtain orderby and order via get_query_var(), instead of the URL.

Fixes #25493.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/post.php

    r34690 r34728  
    10051005    }
    10061006
    1007     if ( isset($q['orderby']) )
     1007    if ( isset( $q['orderby'] ) ) {
    10081008        $orderby = $q['orderby'];
    1009     elseif ( isset($q['post_status']) && in_array($q['post_status'], array('pending', 'draft')) )
     1009    } elseif ( isset( $q['post_status'] ) && in_array( $q['post_status'], array( 'pending', 'draft' ) ) ) {
    10101010        $orderby = 'modified';
    1011 
    1012     if ( isset($q['order']) )
     1011    } else {
     1012        $orderby = 'date';
     1013    }
     1014
     1015    if ( isset( $q['order'] ) ) {
    10131016        $order = $q['order'];
    1014     elseif ( isset($q['post_status']) && 'pending' == $q['post_status'] )
     1017    } elseif ( isset( $q['post_status'] ) && 'pending' == $q['post_status'] ) {
    10151018        $order = 'ASC';
     1019    } else {
     1020        $order = 'desc';
     1021    }
    10161022
    10171023    $per_page = "edit_{$post_type}_per_page";
Note: See TracChangeset for help on using the changeset viewer.