Replace wordpress search with Google Adsense for Search

Well if you notice that my blog’s default search box has been replaced with Google Adsense for Search box. And if you search for anything, results are shown right in my blog and not on Google page. How to do this?

Well so I am writing a guide on how to achieve this. This guide will work for any wordpress template and across almost all wordpress versions.

Steps to add search page in your blog:

  1. Login to your Adsense account and go to Adsense Setup and then select Adsense for Search. Choose Single page as it is easy to track your changes on a single page.
  2. Select Search type Google Websearch + Sitesearch and include your blog’s main url in the box.
  3. You can either keep the google logo, but I would suggest removing it. Use Google Search on button option to remove google logo.
  4. Now come down to Opening of search results type and select Open results within my own sit. Enter your site’s url and then select width as something related to your blog’s theme. For example for my blog I keep it 500. Now in the field Enter URL where search results will be displayed don’t enter your blog’s main url but enter something like http://yourblog.com/google-search
  5. Customise the colors according to your blog theme
  6. If your blog is not about porn, select Safesearch option as well. You should add a new channel to track your earnings better.
  7. Now you will see 2 codes are generated : search box code and search results code. Save both of them somewhere in a text file. Now your job at Adsense site is completed.
  8. Now download MightySearch wordpress plugin. This plugin is just made for inserting google search results in your blog.
  9. Install the plugin and visit Options>>Mightysearch and input searchbox code and search results code in to the text boxes provided.
  10. Now create a new page named Google Search and make sure its page-slug matches the search url created in step 4 above. For example in step4 I mentioned the url http://yourblog.com/google-search so while creating a new page, enter page slug as google-search
  11. Now while creating this page, leave everything blank, select Code tab in write page page and enter
  12. <!–mightysearch–> - to call both search form and search result on the page <!–mightysearch_form–> - to call only search form on the page <!–mightysearch_result–> - to call only search result on the page

  13. So this has completed the job of integrating google search box in your blog. To remove the checked mark to your site instead of web by default, in your search box code find line

    <input name=”sitesearch” id=”ss0″ type=”radio” />

    Remove word checked from this and insert into the second <input type=”radio” /> line.

Tip to replace search box with google box: You can remove all tables code to implement it better. Above code is valid if you are using the page to search via google. But you want to replace default search box with google search box. So open your file where search form exists. For example in my theme, code was in header.php Find <form> tag. Remove the entire code between <form> and </form> including these 2 tags. Now enter their the search box code provided by google. And then for step 11 enter <!–mightysearch–> to your google-search page to display only search results since search box is already in place of your default search box.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • StumbleUpon
  • IndianPad

Related posts

16 Responses to “Replace wordpress search with Google Adsense for Search”


  1. 1 Make money blogging

    Dang.. I was going to blog this too. But it seems you have already blogged it he he :wink:

    [Reply]

    NSpeaks reply on August 2nd, 2007 8:59 am:

    No problem. BTW you are not on mybloglog.com? I am sure you are missing a lot by not being on mybloglog.com!

    [Reply]

  2. 2 jameswillisisthebest

    This is my first post
    just saying HI

    [Reply]

  3. 3 erik

    Hi
    I’ve managed to include the searchresults in my blog (not perfect yet but I will fix it later) My problem is that when I use the search function for the blog, it doesn’t not search in any of the pages. Maybe because they are in the database? Hope you have a tips for me :smile: Thank you!
    best regards Erik

    [Reply]

  4. 4 NSpeaks

    Check whether you have exluded pages from google index? Check your header.php and robots.txt for this.

    [Reply]

  5. 5 Matt

    Awesome, and I’d do this…if I didn’t get banned from them A LONG TIME AGO. Adbrite is better, anyways. Thanks for keeping us updated!

    [Reply]

  6. 6 Fahad

    Good trick. I will be implementing this soon in my blog. :grin:

    [Reply]

  7. 7 How to blog for money

    very nice. I am going to link to this page from my blog.

    [Reply]

  8. 8 Storm

    I can`t find this code in my template

    to change it to

    I`m using “i3Theme 1.6″ theme

    Any tip

    Thanks

    [Reply]

  9. 9 Storm

    input name=”sitesearch” id=”ss0″ type=”radio

    input type=”radio”

    [Reply]

  10. 10 Baris Unver

    I wonder if modifying the search form Google provided is against AdSense TOS or not, can you give any info about that?

    Baris Unver’s last blog post..Tayyip’in bilgisayarı

    [Reply]

  11. 11 imonday

    More about adsense. I received an exciting email yesterday from Joel Comm and I couldn’t wait to share it with you. Joel has just released version 4.0 of his famous Adsense Secrets guide. This guide has been selling for $97 for the past few years and has been the #1 top-selling guide on Google Adsense. Well, Joel is releasing it at an attractive $9.95. This is a no brainer investment. To take advantage of this deal, just go to: http://www.imondayblog.com/goto/as4.html

    [Reply]

  12. 12 Gary

    :D Excellent instructions. Worked perfectly. Thanks!!!

    [Reply]

  13. 13 Chester Bullock

    I am not seeing where you can control the “page slug”?

    [Reply]

    NSpeaks reply on July 24th, 2008 8:51 pm:

    Check Step no. 4 and 10 to check what you can choose for your page slug.

    In latest wp, page slug can be edited by clicking edit beneath your post title bar in write page.

    [Reply]

  14. 14 Chester Bullock

    Never mind, found it.

    [Reply]

  1. 1 links for 2007-07-29 : 7 seconden
  2. 2 My Thought Spot»Blog Archive » MightySearch
  3. 3 geography blogging alltheway
Comments are currently closed.