public static function action_wp_loaded() { if (WPSOLR_Query_Parameters::is_wp_search() && !is_admin() && is_main_query() && WPSOLR_Global::getOption()->get_search_is_replace_default_wp_search()) { // Override global $wp_query with wpsolr_query $GLOBALS['wp_the_query'] = WPSOLR_Global::getQuery(); $GLOBALS['wp_query'] = $GLOBALS['wp_the_query']; } }
/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { if (WPSOLR_Global::getOption()->get_search_is_replace_default_wp_search() && WPSOLR_Global::getOption()->get_search_is_use_current_theme_search_template() && WPSOLR_Query_Parameters::is_wp_search()) { echo $args['before_widget']; $results = WPSOLR_Global::getSolrClient()->display_results(WPSOLR_Global::getQuery()); echo '<div id="res_facets">' . WPSOLR_UI_Facets::Build(WPSOLR_Data_Facets::get_data(WPSOLR_Global::getQuery()->get_filter_query_fields_group_by_name(), WPSOLR_Global::getOption()->get_facets_to_display(), $results[1]), OptionLocalization::get_options()) . '</div>'; echo $args['after_widget']; } }
/** * Constructor used by factory WPSOLR_Global * * @return WPSOLR_Query */ static function global_object(WPSOLR_Query $wpsolr_query = null) { // Create/Update query from parameters return WPSOLR_Query_Parameters::CreateQuery($wpsolr_query); }