Thanks this is awesome! I’m also trying to figure out how to add text to the “Sorry, but no results were found.” page when they come up empty handed. Have any idea? I want to add something saying they can suggest a blog post topic if they don’t find what they are looking for. I can’t find where that text lives! LOL Take it easy and thanks for all your hard work!
Karen
Hello Karen,
That text is usually part of the theme templates. For simpler themes, it can be found in the index.php file in your theme directory. However, this is theme dependent and can be set in any of the theme files.
Thankyou so much. This helped a lot. It took awhile before I realised the problem with hiding the Doctype in IE. I put the Hide Search text script in the footer instead. Thanks a lot!
Smal mode to your code at point 4 instead of adding javascript add that before the php end braket of the funktion.php ?> will work and dont brake xmlrpc.php funktion (by sweeper)
Lovly post and got a realy nice search Box with you help. the only problem now occur is that the point 4. funktion to remove the Search text will brake XMLR. It got renderd . Have to remove it for now . Probably you could test it by yourself posting from Google Docs via Xmlr or any other client .
Thanks for the fix, though in my case I had to look for something else.
In later versions of WordPress there is no searchform.php. What I did to remove the ‘search for’ text was the following:
I went to the general_template.php file; there you look for the search form if there is no searchform.php. Somewhere between line 124 and 170 depending on which version of WordPress one uses.
I deleted the following part:
‘ . __(‘Search for:’) . ‘
The code added to my functions.php completely messed up my headers. Don’t know exactly what is going on, but I am stuck with the “search” text now. Any other options on removing this? When I create a searchform.php it doesn’t seem to search my site ver well.
Hello hw,
The search algorithm should be the same as long as you use your blog url in “action”, and the query argument “s” for the search text.
However, the WordPress native search may not return the best results. I use Google search on my sites. There are several plugins that allow you to do this. Just do a search for “google search” in the plugin page.
Thank you for your response. I actually was just able to incorporate the “search” text into my button design. Not part of my original plan, but we must adapt. I’m happy with it. I really app recite all the help your blog offered me. There wasn’t anything this simple that I was able to find after HOURS of searching!
Hi, when i make this and change the button for a image without background the shape of button continues equal just put the image inside, and in your image your button is a circle and my with the same image button is a square.
Would you have any advice on how to handle editing the search widget if there is no searchform.php file in the theme I am using (I use Matala theme)? Keep in mind that my experience level with HTML is elementary
Thank you!
Nice solution. Just made one tweak. I put the javascript part in header.php, just after opening head-tag. Otherwise it messes up my layout, because it is include before everything.
Thanks for the help removing the “search for” text from my wordpress search widget. It’s obvious you know a lot about PHP and CSS coding… Your site is beautiful!!!
- any idea how to add a username in a link?
for exampe. site url: http://mysite.com/
now adding a username makes it http://mysite.com/username
note. ...
Thanks for this, helped me out. I’d still love a PHP snippet for it to insert in custom page templates!
Thanks this is awesome! I’m also trying to figure out how to add text to the “Sorry, but no results were found.” page when they come up empty handed. Have any idea? I want to add something saying they can suggest a blog post topic if they don’t find what they are looking for. I can’t find where that text lives! LOL Take it easy and thanks for all your hard work!
Karen
Hello Karen,
That text is usually part of the theme templates. For simpler themes, it can be found in the index.php file in your theme directory. However, this is theme dependent and can be set in any of the theme files.
Thankyou so much. This helped a lot. It took awhile before I realised the problem with hiding the Doctype in IE. I put the Hide Search text script in the footer instead. Thanks a lot!
Smal mode to your code at point 4 instead of adding javascript add that before the php end braket of the funktion.php ?> will work and dont brake xmlrpc.php funktion (by sweeper)
// Remove SEARCH Text with GO in Search Box
add_filter(‘get_search_form’, ‘new_search_button’);
function new_search_button($text) {
$text = str_replace(‘value=”Search”‘, ‘value=”Go fetch”‘, $text);
return $text;
}
<?
Thanks! This is a great solution.
I will have to update the tutorial at some point.
But anyway, it’s a good tutorial.
Esay to understand, easy to read. Nice job.
Thanks
You can also add a text-indent css property and use overflow hidden to hide the text.
Lovly post and got a realy nice search Box with you help. the only problem now occur is that the point 4. funktion to remove the Search text will brake XMLR. It got renderd . Have to remove it for now . Probably you could test it by yourself posting from Google Docs via Xmlr or any other client .
Thanks for your help! I’ve been scratching my head trying to resolve this for ages!
Thanks for the fix, though in my case I had to look for something else.
In later versions of WordPress there is no searchform.php. What I did to remove the ‘search for’ text was the following:
I went to the general_template.php file; there you look for the search form if there is no searchform.php. Somewhere between line 124 and 170 depending on which version of WordPress one uses.
I deleted the following part:
‘ . __(‘Search for:’) . ‘
This worked for me. Hopes this helps people.
FYI http://www.2travel4ever.com is still being filled with content.
Thanks for the update Maarten.
Your site looks great – love the design.
The code added to my functions.php completely messed up my headers. Don’t know exactly what is going on, but I am stuck with the “search” text now. Any other options on removing this? When I create a searchform.php it doesn’t seem to search my site ver well.
Hello hw,
The search algorithm should be the same as long as you use your blog url in “action”, and the query argument “s” for the search text.
However, the WordPress native search may not return the best results. I use Google search on my sites. There are several plugins that allow you to do this. Just do a search for “google search” in the plugin page.
Thank you for your response. I actually was just able to incorporate the “search” text into my button design. Not part of my original plan, but we must adapt. I’m happy with it. I really app recite all the help your blog offered me. There wasn’t anything this simple that I was able to find after HOURS of searching!
http://www.northwaydesigns.com/northwaydesigns/WP/
Great that you got it to work! You have some great artwork and designs.
Hooray for you! I searched for a long time and there was very little online about customizing search bars in wordpress!! Feeling grateful!
legend, great help!
cool tutorial…thanks
Hi, when i make this and change the button for a image without background the shape of button continues equal just put the image inside, and in your image your button is a circle and my with the same image button is a square.
[...] more here: WordPress Search Widget – How to Style It Tags: [...]
Great tutorial. Thanks for posting this it helped me a lot.
Happy New Year!
Would you have any advice on how to handle editing the search widget if there is no searchform.php file in the theme I am using (I use Matala theme)? Keep in mind that my experience level with HTML is elementary
Thank you!
I had a quick look at your current blog and the method above should work.
Very useful!! Thanks very much
Nice solution. Just made one tweak. I put the javascript part in header.php, just after opening head-tag. Otherwise it messes up my layout, because it is include before everything.
i have tried this. thank you
Thanks! Great fix.
Most useful!
Thanks!
Thanks for the help removing the “search for” text from my wordpress search widget. It’s obvious you know a lot about PHP and CSS coding… Your site is beautiful!!!
Great tutorial, really helped me out in styling my search bar to better fit the WordPress blog I was theming. Thanks a lot!
The solution for removing the “Search for” text was exactly what I needed, and it worked perfectly. Thank you!