/* Custom Queries for Lotteries */ /* usable when creating custom page template, not copy paste ready code - just custom query example! */ // Return active lottery products. $args = array( 'fields' => 'ids', 'post_type'=> 'product', 'show_past_lottery' => FALSE, 'tax_query' => array(array('taxonomy' => 'product_type' , 'field' => 'slug', 'terms' => 'lottery')), ); // Return past lottery products. $args = array( 'fields' => 'ids', 'post_type'=> 'product', 'show_past_lottery' => TRUE, 'tax_query' => array(array('taxonomy' => 'product_type' , 'field' => 'slug', 'terms' => 'lottery')), 'meta_query' => array( array( 'key' => '_lottery_closed', 'operator' => 'EXISTS', ), ), ); $the_query = new WP_Query( $args );