What I love about WordPress is the fluid ease of interface. When you want an RSS feed for a particular category, you simply add /feed/ after the URL address and you get a feed for that category or for a page/post you get the comment feed. It’s that kind of simplicity that makes WordPress so great for developing websites. Have you ever wanted to offer a search for a particular set of data? No plugin required, this is a great feature built into the WordPress search engine.

First let’s start by looking at the typical search form used in the WordPress default theme.

<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
<label class="hidden" for="s"><?php _e('Search for:'); ?></label>
<div><input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form>

For those who don’t like to look at all the php code. Here is what that would look like after being rendered through php.

<form method="get" id="searchform" action="http://yourdomain.com/">
<label class="hidden" for="s">Search for:</label>
<div><input type="text" value="" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form>

Now let’s say you want to create a search form that only searches a paticular category of your blog site, for this example we’ll call it ‘Test Category’ and say that it has a permalink of ‘testcat’. It’s as simple as modifing the action value of the form element to include the URL for that category. Assuming permalinks are turned on, that would look something like this.

<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/category/testcat/">
<label class="hidden" for="s"><?php _e('Search for:'); ?></label>
<div><input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form>

Rendered through PHP, that comes out looking like this.

<form method="get" id="searchform" action="http://yourdomain.com/category/testcat/">
<label class="hidden" for="s">Search for:</label>
<div><input type="text" value="" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form>

You can do the same thing with tagged items. Giving you the ability to organize what content you want searchable and what content you want to be hidden from the search function.