| @@ 39-54 (lines=16) @@ | ||
| 36 | * |
|
| 37 | * @since 5.0.0 |
|
| 38 | */ |
|
| 39 | public function init_hooks() { |
|
| 40 | if ( ! is_admin() ) { |
|
| 41 | add_filter( 'posts_pre_query', array( $this, 'filter__posts_pre_query' ), 10, 2 ); |
|
| 42 | add_action( 'parse_query', array( $this, 'action__parse_query' ), 10, 1 ); |
|
| 43 | ||
| 44 | add_action( 'init', array( $this, 'set_filters_from_widgets' ) ); |
|
| 45 | ||
| 46 | add_action( 'wp_enqueue_scripts', array( $this, 'load_assets' ) ); |
|
| 47 | add_action( 'wp_footer', array( $this, 'print_instant_search_sidebar' ) ); |
|
| 48 | } else { |
|
| 49 | add_action( 'update_option', array( $this, 'track_widget_updates' ), 10, 3 ); |
|
| 50 | } |
|
| 51 | ||
| 52 | add_action( 'widgets_init', array( $this, 'register_jetpack_instant_sidebar' ) ); |
|
| 53 | add_action( 'jetpack_deactivate_module_search', array( $this, 'move_search_widgets_to_inactive' ) ); |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * Loads assets for Jetpack Instant Search Prototype featuring Search As You Type experience. |
|
| @@ 205-222 (lines=18) @@ | ||
| 202 | * |
|
| 203 | * @since 5.0.0 |
|
| 204 | */ |
|
| 205 | public function init_hooks() { |
|
| 206 | if ( ! is_admin() ) { |
|
| 207 | add_filter( 'posts_pre_query', array( $this, 'filter__posts_pre_query' ), 10, 2 ); |
|
| 208 | ||
| 209 | add_filter( 'jetpack_search_es_wp_query_args', array( $this, 'filter__add_date_filter_to_query' ), 10, 2 ); |
|
| 210 | ||
| 211 | add_action( 'did_jetpack_search_query', array( $this, 'store_last_query_info' ) ); |
|
| 212 | add_action( 'failed_jetpack_search_query', array( $this, 'store_query_failure' ) ); |
|
| 213 | ||
| 214 | add_action( 'init', array( $this, 'set_filters_from_widgets' ) ); |
|
| 215 | ||
| 216 | add_action( 'pre_get_posts', array( $this, 'maybe_add_post_type_as_var' ) ); |
|
| 217 | } else { |
|
| 218 | add_action( 'update_option', array( $this, 'track_widget_updates' ), 10, 3 ); |
|
| 219 | } |
|
| 220 | ||
| 221 | add_action( 'jetpack_deactivate_module_search', array( $this, 'move_search_widgets_to_inactive' ) ); |
|
| 222 | } |
|
| 223 | ||
| 224 | /** |
|
| 225 | * Is search supported on the current plan |
|