Advertisement
Guest User

Untitled

a guest
Dec 20th, 2011
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <?php
  2. $args = array(
  3. 'meta_query' => array(
  4. 'relation' => 'OR',
  5. array('key' => 'unsold'),
  6. array('key' => 'booked'))
  7. );
  8. $firstposts = get_posts($args);
  9.  
  10. $args = array(
  11. 'meta_key' => 'sold'
  12. );
  13. $lastposts = get_posts($args);
  14.  
  15. $mergedposts = array_merge( $firstposts, $lastposts );
  16.  
  17. $post_ids = array();
  18. foreach ( $mergedposts as $mergedpost ) {
  19. $post_ids[] = $mergedpost->ID;
  20. }
  21. // remove duplicates
  22. $unique_id = array_unique($post_ids);
  23.  
  24. $args = array('post__in' => $unique_id);
  25. $the_query = new WP_Query( $args );
  26.  
  27. // The Loop
  28. while ( $the_query->have_posts() ) : $the_query->the_post();
  29. // rest of loop
  30. endwhile;
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement