This one is pretty simple and straight forward. I am just placing it here for future reference and may be it will be helpful to people looking for a similar solution.
If you want to select the first option of an HTML drop down/select control/combo box, just use the following:
Recently I was working on a Wordpress site where I had to design two types of search. Basically the searches needed to identify a particular post category. I designed two search forms one for general search (searchform.php) and the other for category specific search (searchform-category.php). Further deatils are as follow:
General Search:
The General Search was meant to search the entire site except a particular category.
This meant that I needed to exclude that particular category.
For excluding the category, I simply added the the following hidden field:
where 5 denotes the category ID to exclude.
In case you want to exclude multiple categories the following should work:
Category Specific Serach (Advanced Search):
The advanced search was meant to search in on specific category and was available to only logged in users.
This meant that I needed to specifically instruct WP which category to search in.
In my advance/category search form I added the following:
where 5 denotes the category ID to search in.
In case you want to search in multiple categories, the following will work for you
The support forums on Wordpress.org helped me a lot, but there was no clear cut and tested solution available there so I wrote this post for myself and other like me out there :). The above have been tested with Wordpress 3.5.1.
I will be looking at Wordpress Theme Development and Customization in the coming articles, till then: