• I need to have the administrative interface display the posts in reverse chronological order, oldest to newest.

    The website which visitors see, DOES NOT need to display this way.

    I searched inside the wp-admin directory for the command which lists the posts for an &orderby= query option, but came up with nothing.

    Thank You in advance for any assistance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Ellis Benus

    (@glaxton)

    I actually figured this out shortly after posting…

    Go to: wp-admin/includes/post.php

    Scroll down to line number 513

    You are looking for a block like this:

    if ( 'pending' === $q['post_status'] ) {
         $order = 'ASC';
         $orderby = 'modified';
    } elseif ( 'draft' === $q['post_status'] ) {
         $order = 'DESC';
         $orderby = 'modified';
    } else {
         $order = 'DESC';
         $orderby = 'date';
    }

    In the final else {} Change:

    $order = 'ASC';

    to:

    $order = 'DESC';

    That’s it! When you are done the block should look like this:

    if ( 'pending' === $q['post_status'] ) {
         $order = 'ASC';
         $orderby = 'modified';
    } elseif ( 'draft' === $q['post_status'] ) {
         $order = 'DESC';
         $orderby = 'modified';
    } else {
         $order = 'DESC'; /* used to be ASC */
         $orderby = 'date';
    }

    Ok you need to open up wp-admin/includes/post.php
    On line 771 there is a function called function wp_edit_posts_query()
    On line 794 there is

    if ( isset($q['post_status']) && 'pending' === $q['post_status'] ) {
              $order = 'ASC';
              $orderby = 'modified';
          } elseif ( isset($q['post_status']) && 'draft' === $q['post_status'] ) {
              $order = 'DESC';
              $orderby = 'modified';
          } else {
              $order = 'DESC';
              $orderby = 'date';
          }

    replace the DESC’s with ASC’s to look like

    if ( isset($q['post_status']) && 'pending' === $q['post_status'] ) {
              $order = 'ASC';
              $orderby = 'modified';
          } elseif ( isset($q['post_status']) && 'draft' === $q['post_status'] ) {
              $order = 'ASC'; //used to be DESC
              $orderby = 'modified';
          } else {
              $order = 'ASC'; //used to be DESC
              $orderby = 'date';
          }

    You can also on line 805 edit the number of posts displayed per page
    wp("post_type=post&what_to_show=posts$post_status_q&posts_per_page=15&order=$order&orderby=$orderby");

    I hope that helps!

    Oops I posted this without checking to see if anyone else had posted. Anyway we arrived at the same solution which is reassuring!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Admin Interface Reverse Chronological Order’ is closed to new replies.