- // Search Forms
- <form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">
- <input type="text" value="" name="s" id="s" />
- <input type="hidden" name="search-type" value="blog" />
- <input name="submit" type="submit" value="Go" />
- </form>
- // Modifying The Search Template (search.php)
- <?php
- if(isset($_GET['search-type'])) {
- $type = $_GET['search-type'];
- if($type == 'blog') {
- load_template(TEMPLATEPATH . '/blog-search.php');
- } elseif($type == 'products') {
- load_template(TEMPLATEPATH . '/products-search.php');
- }
- }
- ?>
- // Creating The New Search Templates
- <?php
- // blog-search.php
- $args = array( 'post_type' => 'post' );
- $args = array_merge( $args, $wp_query->query );
- query_posts( $args );
- ?>
- <?php
- // products-search.php
- $args = array( 'post_type' => 'products' );
- $args = array_merge( $args, $wp_query->query );
- query_posts( $args );
- ?>
Recent Pastes