/** * Applies search conditions into current query * * @access public * @return void */ public static function loop_properties_filter() { global $wp_query; $query = Realia_Filter::filter_query($wp_query); $query->posts = $query->get_posts(); $wp_query = $query; }
// Area if (!empty($_GET['filter-area'])) { $meta[] = array('key' => REALIA_PROPERTY_PREFIX . 'attributes_area', 'value' => $_GET['filter-area'], 'compare' => '>=', 'type' => 'NUMERIC'); } // Garages if (!empty($_GET['filter-garages'])) { $meta[] = array('key' => REALIA_PROPERTY_PREFIX . 'attributes_garages', 'value' => $_GET['filter-garages'], 'compare' => '>=', 'type' => 'NUMERIC'); } $query->set('meta_query', $meta); $query->set('tax_query', $taxonomies); return $query; } /** * Tweak for displaying sticky posts at the top * * @access public * @param $clauses * @return mixed */ public static function filter_get_meta_sql_19653($clauses) { remove_filter('get_meta_sql', array(__CLASS__, 'filter_get_meta_sql_19653')); // Change the inner join to a left join, // and change the where so it is applied to the join, not the results of the query. $clauses['join'] = str_replace('INNER JOIN', 'LEFT JOIN', $clauses['join']) . $clauses['where']; $clauses['where'] = ''; return $clauses; } } Realia_Filter::init();