<?php /** * The template for displaying Search Results pages. * * @package WordPress * @subpackage Twenty_Eleven * @since Twenty Eleven 1.0 */ $s = bsearch_clean_terms(apply_filters('the_search_query', get_search_query())); get_header(); ?> <section id="primary"> <div id="content" role="main"> <?php $form = get_bsearch_form($s); echo $form; ?> <header class="page-header"> <h1 class="page-title"><?php printf(__('BS TEMPLATE Search Results for: %s', 'twentyeleven'), '<span>' . get_search_query() . '</span>'); ?> </h1> </header> <?php echo get_bsearch_results($s, $limit); ?> <?php echo $form; ?>
/** * returns an array with the first and last indices to be displayed on the page. * * @since 1.2 * * @param int $numrows Total results * @param int $limit Results per page * @return array First and last indices to be displayed on the page */ function get_bsearch_range($numrows, $limit) { global $bsearch_settings; if (!$limit) { $limit = isset($_GET['limit']) ? intval($_GET['limit']) : $bsearch_settings['limit']; // Read from GET variable } $page = isset($_GET['bpaged']) ? intval(bsearch_clean_terms($_GET['bpaged'])) : 0; // Read from GET variable $last = min($page + $limit - 1, $numrows - 1); $match_range = array($page, $last); /** * Filter array with the first and last indices to be displayed on the page. * * @since 1.3 * * @param array $match_range First and last indices to be displayed on the page * @param int $numrows Total results * @param int $limit Results per page */ return apply_filters('get_bsearch_range', $match_range, $numrows, $limit); }
/** * 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; }