'promotions', 'meta_key' => 'sp_ongoingPromotion', 'meta_value' => 1 ); $current_args = array( 'post_type' => 'promotions', 'meta_key' => 'sp_endDate', 'meta_value' => date("Y/m/d"), 'meta_compare' => '>=', 'orderby' => 'meta_value', 'order' => 'ASC' ); // Get promotions using the arguments outlined above. $ongoing_promotions = get_posts( $ongoing_args ); $current_promotions = get_posts( $current_args ); // Merge arrays $all_promotions = array_merge( $ongoing_promotions, $current_promotions ); // Get just the ID of promotions $promotion_ids = wp_list_pluck( $all_promotions, 'ID' ); print_r($promotion_ids); // Do a new query with these IDs to get a properly-sorted list of promotions $args = array( 'post__in' => $promotion_ids, 'numberposts' => 5, 'post_status' => 'publish' ); $wp_query= null; $wp_query = new WP_Query(); $wp_query->query( $args ); $wp_query = new WP_Query($args); if($wp_query->have_posts()){ while($wp_query->have_posts()){ $wp_query->the_post(); ?>

  • format('F d, Y'); } ?>
  • No Posts were found