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.



git-svn-id: https://develop.svn.wordpress.org/trunk@34728 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2015-10-01 02:09:41 +00:00
parent ed1240234d
commit 63b6bc751d
3 changed files with 69 additions and 13 deletions

View File

@@ -1004,15 +1004,21 @@ function wp_edit_posts_query( $q = false ) {
$perm = 'readable';
}
if ( isset($q['orderby']) )
if ( isset( $q['orderby'] ) ) {
$orderby = $q['orderby'];
elseif ( isset($q['post_status']) && in_array($q['post_status'], array('pending', 'draft')) )
} elseif ( isset( $q['post_status'] ) && in_array( $q['post_status'], array( 'pending', 'draft' ) ) ) {
$orderby = 'modified';
} else {
$orderby = 'date';
}
if ( isset($q['order']) )
if ( isset( $q['order'] ) ) {
$order = $q['order'];
elseif ( isset($q['post_status']) && 'pending' == $q['post_status'] )
} elseif ( isset( $q['post_status'] ) && 'pending' == $q['post_status'] ) {
$order = 'ASC';
} else {
$order = 'desc';
}
$per_page = "edit_{$post_type}_per_page";
$posts_per_page = (int) get_user_option( $per_page );