// you’re reading...

Geek stuff

Integrating Google Search into Wordpress

I’ve just changed my Wordpress theme and doing some customizations. I’m not using any plugins for Google Search so I thought I’d share this simple way of integrating it into Wordpress whilst keeping the theme. Everything has been simplified thanks to the improved Adsense for Search.

1. Login to your Google Adsense account, go to Adsense Setup and click on Adsense for Search. Select your desired settings and click Continue. Choose your look and feel and click Continue again. For Opening of search results page, select Open results within my own site and enter “http://yourdomain.com/search-results.php” (without the quotes). Complete the rest of the settings and hit Continue again. You’ll get to Name Your Search Engine, then hit the Submit and Get Code button.

2. There will be two code snippets for you to copy, Search Box Code and Search Results Code. Firstly, copy the Search Box Code. Go back to your Wordpress and Design a Widget, add a Text widget to your sidebar. Edit your Text widget and paste your Search Box Code inside, Save Changes.

3. Next, Write a new Page in Wordpress and give it a title “Search results” (this will generate a page named http://yourdomain.com/search-results.php), uncheck all the fields under Comments & Pings. Now go back to Google and copy and paste your Search Results Code into your Post and Publish.

And there you have it! A personalized Google Search results page!

Discussion

4 comments for “Integrating Google Search into Wordpress”

  1. thanks for the info on adding the google search but I found that if I added the .php on the end of search-results.php it didn’t work. So I simply removed the .php and it worked perfectly

    mny thanks Gavin

    Posted by onefix | October 9, 2008, 1659hrs
  2. Hello!
    Very Interesting post! Thank you for such interesting resource!
    PS: Sorry for my bad english, I’v just started to learn this language ;)
    See you!
    Your, Raiul Baztepo

    Posted by RaiulBaztepo | March 29, 2009, 0859hrs
  3. Thank you for your help!
    I integrated Google search into my website, even though search results have to be 500px or wider.
    I had to change my site a little bit but looks like everything is working just fine.

    Posted by Laptop Repair Guy | May 25, 2009, 1321hrs
  4. I found your blog on google and read a few of your other posts. I just added you to my Google News Reader. Keep up the good work. Look forward to reading more from you in the future.

    Posted by Caine rain | June 10, 2009, 1021hrs

Post a comment