Customizing the WordPress search field

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 thought on “Customizing the WordPress search field”

Leave a Comment