/** * Clause to add code to wp_head * * @since 1.3.3 * * @return string HTML added to the wp_head */ function bsearch_clause_head() { global $wp_query, $bsearch_settings; $bsearch_custom_CSS = stripslashes($bsearch_settings['custom_CSS']); $output = ''; if ($wp_query->is_search) { if ($bsearch_settings['seamless'] && !is_paged()) { $search_query = get_bsearch_query(); $output .= bsearch_increment_counter($search_query); } if ($bsearch_settings['meta_noindex']) { $output .= '<meta name="robots" content="noindex,follow" />'; } // Add custom CSS to header if ('' != $bsearch_custom_CSS) { $output .= '<style type="text/css">' . $bsearch_custom_CSS . '</style>'; } } /** * Filters the output HTML added to wp_head * * @since 2.0.0 * * @return string $output Output HTML added to wp_head */ $output = apply_filters('bsearch_clause_head', $output); echo $output; }
/** * Insert styles into WordPress Head. Filters `wp_head`. * * @since 1.0 */ function bsearch_head() { global $bsearch_settings; $bsearch_custom_CSS = stripslashes($bsearch_settings['custom_CSS']); $search_query = get_bsearch_query(); $limit = isset($_GET['limit']) ? intval($_GET['limit']) : $bsearch_settings['limit']; // Read from GET variable $bpaged = isset($_GET['bpaged']) ? intval($_GET['bpaged']) : 0; // Read from GET variable if (!$bpaged && $bsearch_settings['track_popular']) { echo bsearch_increment_counter($search_query); // Increment the count if we are on the first page of the results } // Add custom CSS to header if ('' != $bsearch_custom_CSS && is_search()) { echo '<style type="text/css">' . $bsearch_custom_CSS . '</style>'; } // Add noindex to search results page if ($bsearch_settings['meta_noindex']) { echo '<meta name="robots" content="noindex,follow" />'; } }
/** * Add counter increment to wp_head only if seamless mode is turned on. * * @access public * @return void */ function bsearch_clause_head() { global $wp_query, $bsearch_settings; $output = ''; if ($wp_query->is_search && $bsearch_settings['seamless'] && !is_paged()) { $search_query = trim(bsearch_clean_terms(apply_filters('the_search_query', get_search_query()))); $output .= bsearch_increment_counter($search_query); } if ($wp_query->is_search && $bsearch_settings['meta_noindex']) { $output .= '<meta name="robots" content="noindex,follow" />'; } echo $output; }