Having played with this recently, here is a quick guide before I forget it. I had to use a little trick, I am not sure if there is an easier way to set it up.
All right, let's get started. We want to use Google Custom Search since your blog deserves better search than the one that comes with WordPress.
First go to Custom Search page and setup the new engine. Option worth noting is Advertising status where you can disable ads if you are non profit.
Once done click 'Code' Page, select 'Host results on your website', and iframe option. Enter your site URL.
This will give you two codes.
First one is the one that you need to put in place of your search form. Find the form in your template, usually in sidebar.php or searchform.php.
Here comes the trick. You need to add the following code into the form:
<input type="hidden" name="s" value="Search" />
This is important because it triggers the WordPress search page (search.php).
Now open search.php and replace what you had before with the code in the second box from Google.
Basically you are done now.
You can do more thing. Add this to the top of your header.php:
<?php $s=$_REQUEST['q']; ?>
Now your theme will display the correct value for search term.
This is really a WP hack - I am not saying it's the best or easiest way to do it.
You can even add the search button in your posts. Go ahead and try it out.
- How to use custom page template in WordPress themes
- Improve Search Engine Placement with Tags
- SEO Smart Links and Category Search plugins
Posted in: WordPress
TAGS:add custom google search, add custom search blog, add google, add google box, add google search website, add search box pages, custom google search, embed google search website, google custom search php, google search custom engine, google search wordpress blog, how add custom searches, paid custom google search, searchpages php searchbox email, wordpress google custom search, wordpress google search