Customizing the WordPress search field

By | August 11, 2005

Wordpress search field

A few readers have asked how I customized my search field. I had some help on this from Melvin, at All Forces, but I’ll pass the code on here.

The file you need to change is “searchform.php”. It’s located in your themes folder. Whenever I try to post the code here, wordpress tires to change it to an actual form field instead of displaying the code. So, I’ll just make the code available for download and you can look at the php file. It basically just involves changing the input type from ‘text’ to ‘search’, and adding a little javascript to put the text in, and take it out when the field is selected.

In Safari, the field shows up as a nice little OS X style input box (may be only Safari 2.0). In other browsers is shows up as a standard rectangular box.

Click here to download my searchform.php file. Leave a comment on this post if you have any questions.


1 Comment

Joey on August 16, 2005 at 6:11 am.

Thanks for sharing. It looks and works great.

Leave Your Comment

Your email will not be published or shared. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail.