WordPress.org

Ready to get started?Download WordPress

Forums

Sort posts in admin in numeric order (3 posts)

  1. kim crimson
    Member
    Posted 4 years ago #

    Hi,

    I'm making a site where all the post titles are numbers, and I would like to be able to sort them in ascending numeric order.

    I've found this in admin/includes/post.php on line 832 in 2.9.1, and changed the order by title:

    if ( isset($q['post_status']) && in_array( $q['post_status'], array_keys($post_stati) ) ) {
    		$post_status_q = '&post_status=' . $q['post_status'];
    		$post_status_q .= '&perm=readable';
    	}
    
    	if ( isset($q['post_status']) && 'pending' === $q['post_status'] ) {
    		$order = 'ASC';
    		$orderby = 'title';
    	} elseif ( isset($q['post_status']) && 'draft' === $q['post_status'] ) {
    		$order = 'ASC';
    		$orderby = 'title';
    	} else {
    		$order = 'ASC';
    		$orderby = 'title';
    	}

    But it doesn't order the titles numerically.. I know of the sort() function, but I can't figure out where to put it in order to sort the post-array..

    Any help will be humbly appreciated!

  2. MichaelH
    Member
    Posted 4 years ago #

    Might start here:
    http://wordpress.org/support/topic/336715/

    Also this plugin might also help but can't be sure:
    http://wordpress.org/extend/plugins/postmash/

  3. kim crimson
    Member
    Posted 4 years ago #

    Thanks,

    I already tried the first solution, but it only sorts the posts alphabetically, not numeric.

    But postmash worked! Thanks a lot!

Topic Closed

This topic has been closed to new replies.

About this Topic