Make WordPress Core

Ticket #32416: 32416.partial.2.patch

File 32416.partial.2.patch, 3.8 KB (added by afercia, 9 years ago)
  • src/wp-admin/includes/class-wp-links-list-table.php

     
    100100        }
    101101
    102102        protected function get_sortable_columns() {
     103
     104                // the initial sorting is by name and ascending
     105                // in the initial view the order on first click on 'Name' should be 'desc'
     106                $desc_first = isset( $_GET['orderby'] ) ? false : true;
     107
    103108                return array(
    104                         'name'    => 'name',
     109                        'name'    => array( 'name', $desc_first ),
    105110                        'url'     => 'url',
    106111                        'visible' => 'visible',
    107112                        'rating'  => 'rating'
  • src/wp-admin/includes/class-wp-media-list-table.php

     
    259259        }
    260260
    261261        protected function get_sortable_columns() {
     262
     263                // the initial sorting is by date and descending
     264                // in the initial view the order on first click on 'Date' should be 'asc'
     265                $desc_first = isset( $_GET['orderby'] ) ? true : false;
     266
    262267                return array(
    263268                        'title'    => 'title',
    264269                        'author'   => 'author',
    265270                        'parent'   => 'parent',
    266271                        'comments' => 'comment_count',
    267                         'date'     => array( 'date', true ),
     272                        'date'     => array( 'date', $desc_first ),
    268273                );
    269274        }
    270275
  • src/wp-admin/includes/class-wp-ms-users-list-table.php

     
    138138        }
    139139
    140140        protected function get_sortable_columns() {
     141
     142                // the initial sorting is by username ('login') and ascending
     143                // in the initial view the order on first click on 'Username' should be 'desc'
     144                $desc_first = isset( $_GET['orderby'] ) ? false : true;
     145
    141146                return array(
    142                         'username'   => 'login',
     147                        'username'   => array( 'login', $desc_first ),
    143148                        'name'       => 'name',
    144149                        'email'      => 'email',
    145150                        'registered' => 'id',
  • src/wp-admin/includes/class-wp-terms-list-table.php

     
    150150        }
    151151
    152152        protected function get_sortable_columns() {
     153
     154                // for non hierarchical taxonomies (tags) the initial sorting is by name and ascending
     155                // in the initial view the order on first click on 'Name' should be 'desc'
     156                if ( ! is_taxonomy_hierarchical( $taxonomy ) && ! isset( $args['orderby'] ) ) {
     157                        $desc_first = isset( $_GET['orderby'] ) ? false : true;
     158                }
     159
    153160                return array(
    154                         'name'        => 'name',
     161                        'name'        => array( 'login', $desc_first ),
    155162                        'description' => 'description',
    156163                        'slug'        => 'slug',
    157164                        'posts'       => 'count',
  • src/wp-admin/includes/class-wp-users-list-table.php

     
    281281         * @return array Array of sortable columns.
    282282         */
    283283        protected function get_sortable_columns() {
     284
     285                // the initial sorting is by username ('login') and ascending
     286                // in the initial view the order on first click on 'Username' should be 'desc'
     287                $desc_first = isset( $_GET['orderby'] ) ? false : true;
     288
    284289                $c = array(
    285                         'username' => 'login',
     290                        'username' => array( 'login', $desc_first ),
    286291                        'name'     => 'name',
    287292                        'email'    => 'email',
    288293                );