How To – Add Google custom search to your WordPress blog.
Not that it matters much, but I’m using the latest version as of June ’09 of WordPress 2.8.
Adding your Google Ad custom search code is very easy and will only take you about 2 minutes.
Just follow these simple steps:
First, create a new post in your blog and call it ‘Search Results’ or similar. If you are using an SEO plugin or you can control the ‘slug’ to this page call the slug ‘search-results’. If you are not using an SEO program you really should be, but never mind. The important thing is to make a note of this page URL and make sure that it is publicly accessible over the Internet. This will be the post where search results will be placed in to by Google and we will need to refer to it later.
Login to your Google AdSense account, select the AdSense Setup tab and then click on AdSense for Search.

Next select whether you want Google to search just your site, a selection of sites (that you type in the box underneith) or the entire web. This can be whatever you like. I’m using only my website for search results. On the same page lower down are options to select the Site Language. Below that is a dropdown list for Your site encoding, yours will probably say Western – You can normally leave this is as it is. Next Select your ‘Country or territory for Google domain’
Now Continue >>
Select the look and feel – you can customise this later so don’t worry about deliberating which one to choose :)
Continue >>
Now this bit you will want to have a look at, where it says:
Opening of search resutls page, you will want to select Open results within my own site

Where is says: Enter the URL where search results will be displayed enter a URL to your website. This is the URL for the page you created in WordPress in step 1 for Google’s search results (for example http://mywebsite.com/search-results or maybe http://mywebsite.com/?p=3)
Next tick the box that says “Your use of these AdSense for Search features is subject to additional terms. By ticking this box and clicking ‘Submit’, you are agreeing to these terms.”

Now type a name for your search engine such as ‘my search’. Now click ‘Submit and Get Code’
OK.
This is the only bit that requires some thought but it’s very easy really. In the top box – This is the code to use for your search feature, simply copy the whole text into your clipboard.

Now locate the file searchform.php. This file will be in your WordPress template folder, for example: mywebsite/wp-content/themes/mytheme/ searchform.php
Read searchform.php in with a text editor and just replace the whole thing with the code you copied from Google. Save this file and upload to your server.
Now copy the text from the bottom box, the text in the Search Results Code box – copy this to your clipboard.
Now edit the post that you created in WordPress earlier called ‘Search – Results’ and past in the code from Google here.
Now click Update Post on your blog. That’s it you’re all good to go.
Having Google search on your blog really does make a difference to your click through rate. Rather than having about 1% or people clicking through, you will find your CTR rising to about 50%.
Happy blogging
Related posts:
- Different browsers give different search results.
- Google AJAX Translation not working with WordPress & Artisteer
- How to check if Google Analytics is working correctly.
- Google Analytics waiting for data…
- Theming Google Apps.
- AdWords keyword tool
- “defizet” This is a test word to see how quickly this page gets indexed by Google
Tags: wordpress
Leave a Reply
Hot Topics
- Creating a Drupal 6 custom login form – Step by Step tutorial.
- WordPress Contact Form 7 & WP-Mail-SMTP problem solved
- imagecache wrong path – SOLVED!
- 7129/6105195 Edward Leedskalnin’s anti-gravity – How he built Coral Castle.
- How to take Ownership of a Drive, Folder or File in Windows 7
- WordPress widgets not saving or dragging?
- Firefox – update favicon.ico (SOLVED)
- IE emulator for FireFox
- Site off-line The site is currently not available due to technical problems. Please try again later. Thank you for your understanding. (SOLVED!)
- Access denied – Drupal 6.x
Archives
- November 2011
- September 2011
- August 2011
- June 2011
- January 2011
- December 2010
- November 2010
- October 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- January 2009
- December 2008
- August 2008
- June 2008
