<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WP Garage &#187; customize</title>
	<atom:link href="http://wpgarage.com/tag/customize/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpgarage.com</link>
	<description>wordpress tricks, hacks, and tips</description>
	<lastBuildDate>Mon, 30 Aug 2010 10:34:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How to Customize Multiple Search Result Pages in WordPress</title>
		<link>http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/</link>
		<comments>http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 07:26:02 +0000</pubDate>
		<dc:creator>Rebecca Markowitz</dc:creator>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[WordPress as CMS]]></category>
		<category><![CDATA[customize]]></category>
		<category><![CDATA[multiple]]></category>
		<category><![CDATA[Pages]]></category>
		<category><![CDATA[results]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://wordpressgarage.com/?p=498</guid>
		<description><![CDATA[In the previous post, we discussed how to hack the search function in WordPress to have an additional search form that would search  subcategories. Now that you have 2 or more search forms on your site, you might need to customize the search results. Thanks to this solution, I learned how to create multiple search [...]]]></description>
			<content:encoded><![CDATA[<p>In the previous post, we discussed how to <a href="http://wpgarage.com/code-snippets/how-to-hack-the-wordpress-search-function-search-categories-and-child-categories/">hack the search function</a> in WordPress to have an additional search form that would search  subcategories. Now that you have 2 or more search forms on your site, you might need to customize the search results. Thanks to <a href="http://www.rob-barrett.com/post/multiple-search-results-pages-within-one-wordpress-site">this solution</a>, I learned how to create multiple search result pages.</p>
<p>Let&#8217;s say we have 2 search forms on our site:</p>
<ol>
<li>General Site-Wide Search</li>
<li>Recipe Search &#8211; searches subcategories of the Recipe Category</li>
</ol>
<p>The first thing we need to do is tweak the search.php template to use it as a filter that will recognize if a search is coming from the Site-Wide search form or the Recipe Search form.</p>
<p><strong>1. Open Search.php</strong> and delete everything.  Add the following code:</p>
<blockquote><p>&lt;?php<br />
/* Template Name: Search Results */<br />
$search_refer = $_GET["site_section"];<br />
if ($search_refer == &#8216;recipe&#8217;) { load_template(TEMPLATEPATH . &#8216;/recipe-search.php&#8217;); }<br />
elseif ($search_refer == &#8216;site-search&#8217;) { load_template(TEMPLATEPATH . &#8216;/site-search.php&#8217;); }; ?&gt;</p></blockquote>
<p><strong>2. Open Header.php</strong> or wherever the General Site-Wide Search Form is located and add this line:</p>
<blockquote><p>&lt;input type=&#8221;hidden&#8221; name=&#8221;site_section&#8221; value=&#8221;site-search&#8221; /&gt;</p></blockquote>
<p><strong>The Site-Wide Search form will look something like this:</strong></p>
<blockquote><p>&lt;form method=&#8221;get&#8221; id=&#8221;searchform&#8221; action=&#8221;&lt;?php bloginfo(&#8216;home&#8217;); ?&gt;/&#8221;&gt;<br />
&lt;div id=&#8221;search&#8221;&gt;<br />
&lt;input type=&#8221;text&#8221; value=&#8221; &#8221; onclick=&#8221;this.value=&#8221;;&#8221; name=&#8221;s&#8221; id=&#8221;s&#8221; /&gt;<strong><br />
&lt;input type=&#8221;hidden&#8221; name=&#8221;site_section&#8221; value=&#8221;site-search&#8221; /&gt;</strong><br />
&lt;input name=&#8221;" type=&#8221;image&#8221; src=&#8221;&lt;?php bloginfo(&#8216;stylesheet_directory&#8217;); ?&gt;/styles/&lt;?php echo &#8220;$style_path&#8221;; ?&gt;/search.gif&#8221; value=&#8221;Go&#8221; /&gt;<br />
&lt;/div&gt;&lt;!&#8211;/search &#8211;&gt;<br />
&lt;/form&gt;</p></blockquote>
<p><strong>3. </strong><strong>Open Recipes.php</strong> or wherever your second search is and insert this line:</p>
<blockquote><p><strong>&lt;input type=&#8221;hidden&#8221; name=&#8221;site_section&#8221; value=&#8221;recipe&#8221; /&gt; </strong></p></blockquote>
<p>You can change the value &#8220;recipe&#8221; to whatever suits your needs. Just make sure it matches the value in search.php.</p>
<p><strong>The Recipe Search form for your second search</strong> <strong>will look something like this</strong>. In my case, this second search is meant to search the subcategories of the Recipe category.  See my previous post to learn about<a href="http://wpgarage.com/code-snippets/how-to-hack-the-wordpress-search-function-search-categories-and-child-categories/"> hacking the search function to search subcategories.</a></p>
<blockquote><p>&lt;form method=&#8221;get&#8221; id=&#8221;rsearchform&#8221; action=&#8221;&lt;?php bloginfo(&#8216;home&#8217;); ?&gt;/&#8221;&gt;<br />
&lt;div id=&#8221;rsearch&#8221;&gt;<br />
&lt;input type=&#8221;text&#8221; value=&#8221;Recipe Search&#8230; &#8221; onclick=&#8221;this.value=&#8221;;&#8221; name=&#8221;s&#8221; id=&#8221;rs&#8221; /&gt;<br />
&lt;?php $categories = get_categories(&#8216;child_of=11&#8242;);<br />
$catlist = &#8221;;<br />
foreach ($categories as $cat) {<br />
$catlist.= $cat-&gt;cat_ID.&#8217;,';<br />
}<br />
$catlist.&#8217;11&#8242;;<br />
?&gt;<br />
&lt;input type=&#8221;hidden&#8221; name=&#8221;cat&#8221; value=&#8221;&lt;?php echo &#8220;$catlist&#8221;?&gt;&#8221; /&gt;<br />
<strong>&lt;input type=&#8221;hidden&#8221; name=&#8221;site_section&#8221; value=&#8221;recipe&#8221; /&gt; </strong><br />
&lt;input name=&#8221;" type=&#8221;image&#8221; src=&#8221;&lt;?php bloginfo(&#8216;stylesheet_directory&#8217;); ?&gt;/styles/&lt;?php echo &#8220;$style_path&#8221;; ?&gt;/search.gif&#8221; value=&#8221;Go&#8221; /&gt;<br />
&lt;/div&gt;&lt;!&#8211;/search &#8211;&gt;<br />
&lt;/form&gt;</p></blockquote>
<p><strong>4. Customize the Search Results Templates</strong></p>
<p>If you recall, in step 1, we added the following to the search.php page.</p>
<blockquote><p>if ($search_refer == &#8216;recipe&#8217;) { load_template(TEMPLATEPATH . &#8216;/recipe-search.php&#8217;); }<br />
elseif ($search_refer == &#8216;site-search&#8217;) { load_template(TEMPLATEPATH . &#8216;/site-search.php&#8217;); }; ?&gt;</p></blockquote>
<p>Create recipe-search.php (or whatever you named this template) and customize the layout of the results page to your liking. You can use index.php to start with and customize from there.</p>
<p>Create site-search.php (or whatever you named this template) and customize the layout of the results page to your liking. You can use index.php to start with and customize from there.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/&amp;title=How+to+Customize+Multiple+Search+Result+Pages+in+Wordpress" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/&amp;title=How+to+Customize+Multiple+Search+Result+Pages+in+Wordpress" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-diigo">
			<a href="http://www.diigo.com/post?url=http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/&amp;title=How+to+Customize+Multiple+Search+Result+Pages+in+Wordpress&amp;desc=In%20the%20previous%20post%2C%20we%20discussed%20how%20to%20hack%20the%20search%20function%20in%20Wordpress%20to%20have%20an%20additional%20search%20form%20that%20would%20search%C2%A0%20subcategories.%20Now%20that%20you%20have%202%20or%20more%20search%20forms%20on%20your%20site%2C%20you%20might%20need%20to%20customize%20the%20search%20results.%20Thanks%20to%20this%20solution%2C%20I%20learned%20how%20to%20create" rel="nofollow" class="external" title="Post this on Diigo">Post this on Diigo</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/&amp;t=How+to+Customize+Multiple+Search+Result+Pages+in+Wordpress" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-friendfeed">
			<a href="http://www.friendfeed.com/share?title=How+to+Customize+Multiple+Search+Result+Pages+in+Wordpress&amp;link=http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/" rel="nofollow" class="external" title="Share this on FriendFeed">Share this on FriendFeed</a>
		</li>
		<li class="shr-gmail">
			<a href="https://mail.google.com/mail/?ui=2&amp;view=cm&amp;fs=1&amp;tf=1&amp;su=How+to+Customize+Multiple+Search+Result+Pages+in+Wordpress&amp;body=Link: http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/ (sent via shareaholic)%0D%0A%0D%0A----%0D%0A In%20the%20previous%20post%2C%20we%20discussed%20how%20to%20hack%20the%20search%20function%20in%20Wordpress%20to%20have%20an%20additional%20search%20form%20that%20would%20search%C2%A0%20subcategories.%20Now%20that%20you%20have%202%20or%20more%20search%20forms%20on%20your%20site%2C%20you%20might%20need%20to%20customize%20the%20search%20results.%20Thanks%20to%20this%20solution%2C%20I%20learned%20how%20to%20create" rel="nofollow" class="external" title="Email this via Gmail">Email this via Gmail</a>
		</li>
		<li class="shr-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/&amp;title=How+to+Customize+Multiple+Search+Result+Pages+in+Wordpress" rel="nofollow" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-googlereader">
			<a href="http://www.google.com/reader/link?url=http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/&amp;title=How+to+Customize+Multiple+Search+Result+Pages+in+Wordpress&amp;srcUrl=http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/&amp;srcTitle=How+to+Customize+Multiple+Search+Result+Pages+in+Wordpress&amp;snippet=In%20the%20previous%20post%2C%20we%20discussed%20how%20to%20hack%20the%20search%20function%20in%20Wordpress%20to%20have%20an%20additional%20search%20form%20that%20would%20search%C2%A0%20subcategories.%20Now%20that%20you%20have%202%20or%20more%20search%20forms%20on%20your%20site%2C%20you%20might%20need%20to%20customize%20the%20search%20results.%20Thanks%20to%20this%20solution%2C%20I%20learned%20how%20to%20create" rel="nofollow" class="external" title="Add this to Google Reader">Add this to Google Reader</a>
		</li>
		<li class="shr-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/&amp;title=How+to+Customize+Multiple+Search+Result+Pages+in+Wordpress&amp;summary=In%20the%20previous%20post%2C%20we%20discussed%20how%20to%20hack%20the%20search%20function%20in%20Wordpress%20to%20have%20an%20additional%20search%20form%20that%20would%20search%C2%A0%20subcategories.%20Now%20that%20you%20have%202%20or%20more%20search%20forms%20on%20your%20site%2C%20you%20might%20need%20to%20customize%20the%20search%20results.%20Thanks%20to%20this%20solution%2C%20I%20learned%20how%20to%20create&amp;source=WP Garage" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="shr-netvibes">
			<a href="http://www.netvibes.com/share?title=How+to+Customize+Multiple+Search+Result+Pages+in+Wordpress&amp;url=http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/" rel="nofollow" class="external" title="Submit this to Netvibes">Submit this to Netvibes</a>
		</li>
		<li class="shr-posterous">
			<a href="http://posterous.com/share?linkto=http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/&amp;title=How+to+Customize+Multiple+Search+Result+Pages+in+Wordpress&amp;selection=In%20the%20previous%20post%2C%20we%20discussed%20how%20to%20hack%20the%20search%20function%20in%20Wordpress%20to%20have%20an%20additional%20search%20form%20that%20would%20search%C2%A0%20subcategories.%20Now%20that%20you%20have%202%20or%20more%20search%20forms%20on%20your%20site%2C%20you%20might%20need%20to%20customize%20the%20search%20results.%20Thanks%20to%20this%20solution%2C%20I%20learned%20how%20to%20create" rel="nofollow" class="external" title="Post this to Posterous">Post this to Posterous</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/&amp;title=How+to+Customize+Multiple+Search+Result+Pages+in+Wordpress" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-slashdot">
			<a href="http://slashdot.org/bookmark.pl?url=http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/&amp;title=How+to+Customize+Multiple+Search+Result+Pages+in+Wordpress" rel="nofollow" class="external" title="Submit this to SlashDot">Submit this to SlashDot</a>
		</li>
		<li class="shr-sphinn">
			<a href="http://sphinn.com/index.php?c=post&amp;m=submit&amp;link=http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/" rel="nofollow" class="external" title="Sphinn this on Sphinn">Sphinn this on Sphinn</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/&amp;title=How+to+Customize+Multiple+Search+Result+Pages+in+Wordpress" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-techmeme">
			<a href="http://twitter.com/home/?status=Tip+@Techmeme+http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/+&quot;How+to+Customize+Multiple+Search+Result+Pages+in+Wordpress&quot;&amp;source=shareaholic" rel="nofollow" class="external" title="Tip this to TechMeme">Tip this to TechMeme</a>
		</li>
		<li class="shr-tumblr">
			<a href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fwpgarage.com%2Fcode-snippets%2Fhow-to-customize-multiple-search-result-pages-in-wordpress%2F&amp;t=How+to+Customize+Multiple+Search+Result+Pages+in+Wordpress" rel="nofollow" class="external" title="Share this on Tumblr">Share this on Tumblr</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=How+to+Customize+Multiple+Search+Result+Pages+in+Wordpress+-++%28via+%40wpgarage%29&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-mail">
			<a href="mailto:?subject=%22How%20to%20Customize%20Multiple%20Search%20Result%20Pages%20in%20Wordpress%22&amp;body=Link: http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/ (sent via shareaholic)%0D%0A%0D%0A----%0D%0A In%20the%20previous%20post%2C%20we%20discussed%20how%20to%20hack%20the%20search%20function%20in%20Wordpress%20to%20have%20an%20additional%20search%20form%20that%20would%20search%C2%A0%20subcategories.%20Now%20that%20you%20have%202%20or%20more%20search%20forms%20on%20your%20site%2C%20you%20might%20need%20to%20customize%20the%20search%20results.%20Thanks%20to%20this%20solution%2C%20I%20learned%20how%20to%20create" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a>
		</li>
		<li class="shr-printfriendly">
			<a href="http://www.printfriendly.com/print?url=http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/" rel="nofollow" class="external" title="Send this page to Print Friendly">Send this page to Print Friendly</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://wpgarage.com/code-snippets/how-to-customize-multiple-search-result-pages-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
