Make WordPress Core


Ignore:
Timestamp:
08/11/2010 09:54:51 PM (16 years ago)
Author:
scribu
Message:

Ajaxify list-type screens in the admin. See #14579

File:
1 edited

Legend:

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

    r15450 r15491  
    881881        }
    882882
    883         if ( isset($q['post_status']) && 'pending' === $q['post_status'] ) {
     883        if ( isset($q['orderby']) )
     884                $orderby = $q['orderby'];
     885        elseif ( isset($q['post_status']) && in_array($q['post_status'], array('pending', 'draft')) )
     886                $orderby = 'modified';
     887
     888        if ( isset($q['order']) )
     889                $order = $q['order'];
     890        elseif ( isset($q['post_status']) && 'pending' == $q['post_status'] )
    884891                $order = 'ASC';
    885                 $orderby = 'modified';
    886         } elseif ( isset($q['post_status']) && 'draft' === $q['post_status'] ) {
    887                 $order = 'DESC';
    888                 $orderby = 'modified';
    889         } else {
    890                 $order = 'DESC';
    891                 $orderby = 'date';
    892         }
    893892
    894893        $per_page = 'edit_' . $post_type . '_per_page';
     
    903902
    904903        // Hierarchical types require special args.
    905         if ( is_post_type_hierarchical( $post_type ) ) {
     904        if ( is_post_type_hierarchical( $post_type ) && !isset($orderby) ) {
    906905                $query['orderby'] = 'menu_order title';
    907906                $query['order'] = 'asc';
     
    974973                unset($q['post_mime_type']);
    975974
     975        if ( isset($q['detached']) )
     976                add_filter('posts_where', '_edit_attachments_query_helper');
     977
    976978        wp($q);
    977979
     980        if ( isset($q['detached']) )
     981                remove_filter('posts_where', '_edit_attachments_query_helper');
     982
    978983        return array($post_mime_types, $avail_post_mime_types);
     984}
     985
     986function _edit_attachments_query_helper($where) {
     987        return $where .= ' AND post_parent < 1';
    979988}
    980989
Note: See TracChangeset for help on using the changeset viewer.