You all know i had a theme change about a week ago. This theme is great and i really love it. As it seems you guys love it too. Anyways, since day one i noticed there is no search field nowhere in the theme. That was a pretty strange fact i hadn’t seen in any theme i’ve seen and tried out before. I didn’t really care much in the beginning since i can search from the admin area and i really thought that you guys, my readers, wouldn’t really need the search function. I was mistaken. My friend and loyal reader Giwrgos (George) came back to me with a comment about the missing search functionality. As he is a techy guy himself, he was able to pull out a search the hard way, but, i was troubled about how any other non techish guy could do it. So i started considering my various options.

For starters i could add a search field somewhere in the theme. That was not really an option since i am not that good on designing and i could really mess up the look and feel of the site (something i’d hate to do since i really like this look). And here is what i came up with.

I created a page that has a small search form. If you notice the menu there is a search link that leads to that page. Now, for you to get a grasp about it, all we need to do is create a link that has the form:

http://www.yoursite.com/?s=search+term

This can be easily done. All we need is a small form that submits data to the root URL of our blog using a get method. Here is the code:

<form action="/" method="get">
	<input type="text" name="s">
	<input type="submit" value="Search">
</form>

This is a very simple form but i need you to notice a couple of things:

  • The “action” parameter on the form element tells where the form must be submitted. Now, if your blog resides on a top level domain, for example “http://www.yoursite.com” then this is just fine. Though, if your site is on a subfolder, for example the URL is “http://www.yoursite.com/blog/” then the action parameter needs to be set accordingly. For the previous example it should be: “action=’/blog/’“. Please notice that a subdomain is the same thing as a top level. I mean, if you site is “http://blog.yoursite.com” your don’t need to modify the action parameter.
  • The “name” parameter on the input text element is “s”. This is the name of the variable on the search link given above.

Now to use this form all you need to do is the following:

  1. Create a new page.
  2. Write a small text telling the users that this page is to search content blah-blah.
  3. Go to the HTML tab.
  4. Copy-paste the form there.
  5. Hit save and publish!

Easy huh? That’s the point here… I hope i covered the subject pretty thouroughly and in enough detail in order for you to be able to do it easily yourselves. If, for any reason you have a problem or a comment, as always, i’ll be glad to hear about it!