prefix; $join .=" JOIN ".$db_prefix."ai1ec_events ON $wpdb->posts.ID = ".$db_prefix."ai1ec_events.post_id"; return $join; } function set_ai1ec_where( $where, &$wp_query ){ global $wpdb; $db_prefix=$wpdb->prefix; if(! is_admin() && $wp_query->post_type ='ai3ec_event'){ date_default_timezone_set("Europe/Rome"); $where .= ' AND '. $db_prefix.'ai1ec_events.end >= \''.time().'\''; return $where; } } function set_ai1ec_limits( $limit, $query ) { return 'LIMIT 0, 5'; } add_filter('posts_orderby', 'set_ai1ec_orderby'); function set_ai1ec_orderby($orderby) { global $wpdb; $db_prefix=$wpdb->prefix; $orderby = $db_prefix."ai1ec_events.start ASC"; return $orderby; } function get_ai1ec_box($attrs){ ?> 'ai1ec_event', 'no_found_rows' => 1, 'posts_per_page' => $Posts, 'offset'=> '', 'tax_query' => array( array( 'field' => 'id', 'terms' => $page_ids, 'taxonomy' => 'events_categories', ) ), ); add_filter('posts_join', 'set_ai1ec_join',10,2); add_filter( 'posts_where', 'set_ai1ec_where', 10, 2 ); add_filter('posts_orderby', 'set_ai1ec_orderby'); add_filter( 'post_limits', 'set_ai1ec_limits', 10, 2 ); //http://codex.wordpress.org/Class_Reference/WP_Query $cat_query = new WP_Query($args); remove_filter('posts_join', 'set_ai1ec_join'); remove_filter( 'posts_where', 'set_ai1ec_where'); remove_filter('posts_orderby', 'set_ai1ec_orderby'); remove_filter( 'post_limits', 'set_ai1ec_limits'); $count = 0; ?>

have_posts()): ?>

have_posts()): ?>

have_posts()): ?>