Wordpress custom sort by meta key

I have a WordPress query that I need to pull out the posts that have a custom meta key of “original-document”. In short I need to have all of the posts with the meta key value in 1 column and the rest of the results in another column. Any ideas on how I can accomplish this?

Use get_posts()

$custom_posts = get_posts( array(
    'posts_per_page' => 10,
    'orderby' => 'post_date',
    'order' => 'DESC',
    'meta_key' => 'original-document',
) );

foreach ( $custom_posts as $custom_post ) {
    //..... access all your post values in $custom_post

Thank you for this reply, this is what I had thought of for grabbing the original-documents, but how then do I grab everything EXCEPT the original documents?

See usage of meta_query here in docs.

Thank you again for the reply. Let me explain a little bit more. This is on a archive.php. I have built a custom filter that uses a custom post taxonomy of “classification”. You can see what I have put together here http://www.constitutingamerica.org/dev2 <– see the drop downs. Then using http://www.advancedcustomfields.com/ I have make it so a post can be tagged as an “Original Document”. On this archive.php page I want to have all of my “Original Documents” on the left and all other posts on the right. Just the post titles I also want to not have any pagination on this page.

As far as I can see Advanced Custom Fields plugin stores data in post meta. Taxonomy is different. So of the following what do you seek:

  1. Show posts with taxonomy ‘classification’ & meta key ‘Original Documents’ on left and remaining posts on right?
  2. Show posts with meta key ‘Original Documents’ on left and taxonomy ‘classification’ posts on right?