slug = add_submenu_page( 'jetpack', __( 'Omnisearch', 'jetpack' ), __( 'Omnisearch', 'jetpack' ), 'edit_posts', 'omnisearch', array( $this, 'omnisearch_page' ) ); add_action( "admin_print_styles-{$this->slug}", array( $this, 'admin_print_styles_jetpack' ) ); } function admin_menu() { $this->slug = add_dashboard_page( __( 'Omnisearch', 'jetpack' ), __( 'Omnisearch', 'jetpack' ), 'edit_posts', 'omnisearch', array( $this, 'omnisearch_page' ) ); add_action( "admin_print_styles-{$this->slug}", array( $this, 'admin_print_styles' ) ); } function admin_print_styles() { wp_enqueue_style( 'omnisearch-admin' ); } function admin_print_styles_jetpack() { wp_enqueue_style( 'omnisearch-admin' ); wp_enqueue_style( 'omnisearch-jetpack' ); } function omnisearch_page() { $results = array(); $s = isset( $_GET['s'] ) ? $_GET['s'] : ''; if ( $s ) { /** * Filter the results returned for a given Omnisearch search query. * * @module omnisearch * * @since 2.3.0 * * @param array $results Array of Omnisearch results. * @param string $s Search parameter. */ $results = apply_filters( 'omnisearch_results', $results, $s ); } /** * Filter the number of results displayed for each Omnisearch searched section. * * @module omnisearch * * @since 2.3.0 * * @param int 5 Number of results displayed for each Omnisearch searched section. */ $num_results = intval( apply_filters( 'omnisearch_num_results', 5 ) ); ?>
'adminbarsearch', 'search_id' => 'adminbar-search', 'search_class' => 'adminbar-input', 'submit_class' => 'adminbar-button', ) ); $form .= ""; $wp_admin_bar->add_menu( array( 'parent' => 'top-secondary', 'id' => 'search', 'title' => $form, 'meta' => array( 'class' => 'admin-bar-search', 'tabindex' => -1, ) ) ); } static function get_omnisearch_form( $args = array() ) { $defaults = array( 'form_id' => null, 'form_class' => null, 'search_class' => null, 'search_id' => null, 'search_value' => isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : null, 'search_placeholder' => __( 'Search Everything', 'jetpack' ), 'submit_class' => 'button', 'submit_value' => __( 'Search', 'jetpack' ), 'alternate_submit' => false, ); extract( array_map( 'esc_attr', wp_parse_args( $args, $defaults ) ) ); $rand = rand(); if( empty( $form_id ) ) $form_id = "omnisearch_form_$rand"; if( empty( $search_id ) ) $search_id = "omnisearch_search_$rand"; ob_start(); ?>