示例#1
0
echo __('Search Results for: ', 'better-search');
?>
				<span>
					<?php 
echo $search_query;
?>
				</span>
			</h1>

			<?php 
echo get_bsearch_results($search_query, $limit);
?>
		</div>	<!-- Close id="bsearchresults" -->

		<?php 
echo get_bsearch_form($search_query);
?>

		<?php 
if ($bsearch_settings['include_heatmap']) {
    ?>

			<div id="heatmap">
				<div class="heatmap_daily">
					<h2>
						<?php 
    echo strip_tags($bsearch_settings['title_daily']);
    ?>
					</h2>

					<?php 
<?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;
?>
示例#3
0
/**
 * Displays the search results
 *
 * First checks if the theme contains a search template and uses that
 * If search template is missing, generates the results below
 */
function bsearch_template_redirect()
{
    // not a search page; don't do anything and return
    if (stripos($_SERVER['REQUEST_URI'], '?s=') === FALSE && stripos($_SERVER['REQUEST_URI'], '/search/') === FALSE && !is_search()) {
        return;
    }
    global $wp_query, $bsearch_settings;
    // If seamless integration mode is activated; return
    if ($bsearch_settings['seamless']) {
        return;
    }
    // if we have a 404 status
    if ($wp_query->is_404) {
        // set status of 404 to false
        $wp_query->is_404 = false;
        $wp_query->is_archive = true;
    }
    // change status code to 200 OK since /search/ returns status code 404
    @header("HTTP/1.1 200 OK", 1);
    @header("Status: 200 OK", 1);
    $search_query = trim(bsearch_clean_terms(apply_filters('the_search_query', get_search_query())));
    $limit = isset($_GET['limit']) ? intval($_GET['limit']) : $bsearch_settings['limit'];
    // Read from GET variable
    add_action('wp_head', 'bsearch_head');
    add_filter('wp_title', 'bsearch_title');
    // If there is a template file within the parent or child theme then we use it
    $priority_template_lookup = array(get_stylesheet_directory() . '/better-search-template.php', get_template_directory() . '/better-search-template.php');
    foreach ($priority_template_lookup as $exists) {
        if (file_exists($exists)) {
            include_once $exists;
            exit;
        }
    }
    // Create a template here if there is a template
    get_header();
    echo '<div id="content" class="bsearch_results_page">';
    echo get_bsearch_form($search_query);
    echo '<div id="bsearchresults"><h1 class="page-title">';
    echo __('Search Results for: ', BSEARCH_LOCAL_NAME) . '<span>' . $search_query . '</span>';
    echo '</h1>';
    echo get_bsearch_results($search_query, $limit);
    echo '</div>';
    // Close id="bsearchresults"
    echo get_bsearch_form($search_query);
    if ($bsearch_settings['include_heatmap']) {
        echo '<div id="heatmap">';
        echo '<div class="heatmap_daily">';
        echo '<h2>';
        echo strip_tags($bsearch_settings['title_daily']);
        echo '</h2>';
        echo get_bsearch_heatmap('daily=1');
        // Overall heatmap
        echo '</div>';
        // Close class="heatmap_daily"
        echo '<div class="heatmap_overall">';
        echo '<h2>';
        echo strip_tags($bsearch_settings['title']);
        echo '</h2>';
        echo get_bsearch_heatmap('daily=0');
        // Overall heatmap
        echo '</div>';
        // Close class="heatmap_overall"
        echo '<div style="clear:both">&nbsp;</div>';
        echo '</div>';
    }
    echo '</div>';
    // Close id="content"
    //get_sidebar();
    get_footer();
    exit;
}