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:
This is a very simple form but i need you to notice a couple of things:
Now to use this form all you need to do is the following:
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!
I don’t think you would have messed up your layout by adding it to the sidebar. Does your theme use widgets?
That being said – this is good tutorial on making a separate search page.
@Kim: I thought about a widget but it would need some customization on coloring and stuff and a) i’m not that good at that and b) i’m a lazyass
So the page seemed like a good solution… As for the separate page i think that in general it’s a good idea to support it…
why a widget would need coloring? If your theme supports widgeted sidebar, you must be able to put in the code for search if I am not wrong.
@Raju: Well you are right but i would need to style the textbox and the button. Plus i have a very long sidebar i don’t want it to grow… i am looking for ways to shrink it a little bit…
How about having it as part of the header (floating right) next to wp-plugins)?