Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $args = array(
- 'meta_query' => array(
- 'relation' => 'OR',
- array('key' => 'unsold'),
- array('key' => 'booked'))
- );
- $firstposts = get_posts($args);
- $args = array(
- 'meta_key' => 'sold'
- );
- $lastposts = get_posts($args);
- $mergedposts = array_merge( $firstposts, $lastposts );
- $post_ids = array();
- foreach ( $mergedposts as $mergedpost ) {
- $post_ids[] = $mergedpost->ID;
- }
- // remove duplicates
- $unique_id = array_unique($post_ids);
- $args = array('post__in' => $unique_id);
- $the_query = new WP_Query( $args );
- // The Loop
- while ( $the_query->have_posts() ) : $the_query->the_post();
- // rest of loop
- endwhile;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement