diff --git a/ai1ec_box.php b/ai1ec_box.php index 3fa1020..6018f0c 100644 --- a/ai1ec_box.php +++ b/ai1ec_box.php @@ -1,9 +1,9 @@ prefix; - $join .=" LEFT JOIN ".$db_prefix."ai1ec_events + $join .=" JOIN ".$db_prefix."ai1ec_events ON $wpdb->posts.ID = ".$db_prefix."ai1ec_events.post_id"; return $join; @@ -11,25 +11,19 @@ function set_ai1ec_join($join, &$wp_query) { 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"); - $now=time(); - $where .= ' AND (' . $wpdb->ai1ec_events.start .' >= \''.$now.'\' '. - 'OR ' . $wpdb->ai1ec_events.end .' >= \''.$now.'\' )'; - + $where .= ' AND '. $db_prefix.'ai1ec_events.end >= \''.time().'\''; + return $where; } } function set_ai1ec_limits( $limit, $query ) { - - if ( ! is_admin() && $query->is_main_query() && $query->is_search() ) { - return 'LIMIT 0, 6'; - } - - return $limit; + return 'LIMIT 0, 5'; } add_filter('posts_orderby', 'set_ai1ec_orderby'); @@ -58,12 +52,20 @@ function get_ai1ec_box($attrs){ ?> 'no_found_rows' => 1, 'posts_per_page' =>$Posts, 'offset'=> '', + 'tax_query' => array( + array( + 'field' => 'id', + 'terms' => array(34), + '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'); @@ -111,6 +113,9 @@ function get_ai1ec_box($attrs){ ?>

+
+ +
@@ -159,6 +164,9 @@ function get_ai1ec_box($attrs){ ?>

+
+ +
@@ -207,6 +215,9 @@ function get_ai1ec_box($attrs){ ?>

+
+ +