mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
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:
@@ -120,6 +120,30 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
return current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_posts );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of the 'orderby' query var.
|
||||
*
|
||||
* @access protected
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @return string The value of 'orderby'.
|
||||
*/
|
||||
protected function get_orderby() {
|
||||
return strtolower( get_query_var( 'orderby' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of the 'order' query var.
|
||||
*
|
||||
* @access protected
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @return string The value of 'order'.
|
||||
*/
|
||||
protected function get_order() {
|
||||
return strtolower( get_query_var( 'order' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @global array $avail_post_stati
|
||||
@@ -130,6 +154,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||
public function prepare_items() {
|
||||
global $avail_post_stati, $wp_query, $per_page, $mode;
|
||||
|
||||
// is going to call wp()
|
||||
$avail_post_stati = wp_edit_posts_query();
|
||||
|
||||
$this->set_hierarchical_display( is_post_type_hierarchical( $this->screen->post_type ) && 'menu_order title' === $wp_query->query['orderby'] );
|
||||
|
||||
Reference in New Issue
Block a user