I have it built to have people be able to search the blog they are on first. If they want to broaden their search results there is another search field on the results page that pulls from the specific set of blogs. The loop is a little more complicated because it is a Wootheme’s Canvas loop.
<?php
/**
* Loop - Search
*
* This is the loop logic used on the search results screen.
*
* @package WooFramework
* @subpackage Template
*/
global $more; $more = 0;
woo_loop_before();
if (have_posts()) { $count = 0;
$title_before = '<span class="archive_header">';
$title_after = '</span>';
//echo $title_before . sprintf( __( 'Search results for "%s"', 'woothemes' ), get_search_query() ) . $title_after;
?>
<h2 class="pagetitle">Search Result for <?php /* Search Count */ $allsearch = &new WP_Query("s=$s&showposts=-1"); $key = wp_specialchars($s, 1); $count = $allsearch->post_count; _e(''); _e('<span class="search-terms">'); echo $key; _e('</span>'); _e(' — '); echo $count . ' '; _e('articles'); wp_reset_query(); ?></h2><hr>
<div>
<h3>Not finding what you are looking for? Search all FMCUSA sites.</h3><form method="get" action="https://fmcusa.org/">
<span class="fr secondary-search">
<input type="text" value="To search, type and hit enter..." name="s" id="s" onfocus="if (this.value == 'To search, type and hit enter...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'To search, type and hit enter...';}" />
<input type="hidden" id="searchsubmit" value="Search" />
<input type="hidden" name="searchblogs" value="34,35,13,14,15,37,50,48,9" />
</form></span>
</div>
<hr>
<div class="fix"></div>
<?php switch_to_blog($post->blog_id); ?>
<?php
while (have_posts()) { the_post(); $count++;
if (get_option('woo_woo_tumblog_switch') == 'true') { $is_tumblog = woo_tumblog_test(); } else { $is_tumblog = false; }
$title_before = '<h1 class="title">';
$title_after = '</h1>';
if ( ! is_single() ) {
$title_before = $title_before . '<a href="' . get_permalink( get_the_ID() ) . '" rel="bookmark" title="' . the_title_attribute( array( 'echo' => 0 ) ) . '">';
$title_after = '</a>' . $title_after;
}
$page_link_args = apply_filters( 'woothemes_pagelinks_args', array( 'before' => '<div class="page-link">' . __( 'Pages:', 'woothemes' ), 'after' => '</div>' ) );
woo_post_before();
?>
<div <?php post_class(); ?>>
<?php
woo_post_inside_before();
the_title( $title_before, $title_after );
woo_post_meta();
?>
<div class="entry">
<?php
the_excerpt();
wp_link_pages( $page_link_args );
?>
</div><!-- /.entry -->
<?php
woo_post_inside_after();
?>
</div><!-- /.post -->
<?php
woo_post_after();
comments_template();
} // End WHILE Loop
} else {
get_template_part( 'content', 'noposts' );
} // End IF Statement
woo_loop_after();
woo_pagenav();
?>