bitful

UK-based weblog on technology, queerness, language and fitness

WordPress search widget inline button fix

Electronic circuits

The default WordPress search widget used with the default WordPress Kubrick theme displays the Search button on a new line. I don't like that.

I spent a fair amount of time looking for a fix, then looked into it myself and found that:

  1. you need to remove the return 'br' tag in wp-includes\widgets.php (line 411 in WordPress v. 2.2.1, or line 375 in v. 2.2, or line 413 in v. 2.3.1 and 2.3.2, or line 444 in v. 2.5, or line 464 in v. 2.5.1), and
  2. the

  3. you must style the form element #s to be 107 instead of 108 pixels (or reduce the padding from 2 to 1px), otherwise the extra pixel throws the search button on a new line.

Remember to reapply the change to widgets.php every time you upgrade to a new version of WordPress, as the new file will overwrite the old one.

I have absolutely no idea why they made it so complicated. If anyone can explain that to me, it would be much appreciated - thanks!

UPDATE Saturday 9 August 2008: I just upgraded to WordPress 2.6 and there was no need to edit the form element #6, as the search button was already on the same line as the text field.

2 Responses to “WordPress search widget inline button fix”

  1. l.a. Says:

    Thanks so much for the fix. It was driving me bonkers trying to figure it out. I also modified my Meta options in the same PHP file. Thanks so much!

  2. Jack Tanner Says:

    Alternatively, add this to your stylesheet:

    form.searchform {display: inline;}

    No need to remember to hack widgets.php every time, either.