Make WordPress Core


Ignore:
Timestamp:
10/09/2007 10:49:42 PM (18 years ago)
Author:
ryan
Message:

jquery for list manipulation. Round one, fight. Props mdawaffe. fixes #4805

File:
1 edited

Legend:

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

    r6125 r6213  
    469469}
    470470
     471function wp_edit_posts_query( $q = '_GET' ) {
     472    global $wpdb;
     473    $$q['m']   = (int) $$q['m'];
     474    $$q['cat'] = (int) $$q['cat'];
     475    $post_stati  = array(   //  array( adj, noun )
     476                'draft' => array(__('Draft'), _c('Drafts|manage posts header')),
     477                'future' => array(__('Scheduled'), __('Scheduled posts')),
     478                'pending' => array(__('Pending Review'), __('Pending posts')),
     479                'private' => array(__('Private'), __('Private posts')),
     480                'publish' => array(__('Published'), __('Published posts'))
     481            );
     482
     483    $avail_post_stati = $wpdb->get_col("SELECT DISTINCT post_status FROM $wpdb->posts WHERE post_type = 'post'");
     484
     485    $post_status_q = '';
     486    $post_status_label = _c('Posts|manage posts header');
     487    if ( isset($$q['post_status']) && in_array( $$q['post_status'], array_keys($post_stati) ) ) {
     488        $post_status_label = $post_stati[$$q['post_status']][1];
     489        $post_status_q = '&post_status=' . $$q['post_status'];
     490    }
     491
     492    if ( 'pending' === $$q['post_status'] ) {
     493        $order = 'ASC';
     494        $orderby = 'modified';
     495    } elseif ( 'draft' === $$q['post_status'] ) {
     496        $order = 'DESC';
     497        $orderby = 'modified';
     498    } else {
     499        $order = 'DESC';
     500        $orderby = 'date';
     501    }
     502
     503    wp("what_to_show=posts$post_status_q&posts_per_page=20&order=$order&orderby=$orderby");
     504
     505    return array($post_stati, $avail_post_stati);
     506}
     507
    471508?>
Note: See TracChangeset for help on using the changeset viewer.