WordPress.org

Ready to get started?Download WordPress

Forums

Admin Interface Reverse Chronological Order (2 posts)

  1. Ellis Benus
    Member
    Posted 4 years ago #

    I would like to write a plugin which reverses the chronological order posts are displayed in the Edit Posts page of the WordPress administration panel.

    The following post shows how to change the hard coding of the wp-admin/includes/post.php file, but this needs to be accomplished without changing the core wordpress files.

    The function that needs to be changed is wp_edit_posts_query() as the above article points out.

    The block of code as it appears normally 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';
    	}

    To accomplish this task, it needs to be changed to:

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

    Basically, just changing DESC to ASC.

    Any help would be appreciated.

  2. MichaelH
    Member
    Posted 4 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic