How to implement Google Adsense Search in Wordpress blog and make money

By Ashish Mohta

Search feature is a major requirement in any site. Its not easy to keep on searching in archive of any site. In this article we will learn how to implement AdSense search results within WordPress Pages. Making money is another part of it. This question was asked to my by Shankar after he saw its implemented on my site. Prior to starting this tutorial I don’t take any responsibility if any article similar to this is already written. I have done it with my own experience.

Here are the steps which we will follow.:-

  • Making a Page on your Wordpress blog.
  • Creating Adsense code from Adsense account by Google Adsense for Search.
  • Understanding , Creating a template file for Search Page and Adding Adsense Code
  • Applying the template to the page you created in 1st step.

Create a page in your Wordpress blog:


Its an easy step.

  • Login to your Wordpress admin area.
  • Go to Manage > Write > Write Page.
  • Add a suitable title and page-slug. E.g - Page Title : Site Search . Page Slug - Google-search
  • On the sidebar of editor you will find option of adding Template to the page. Leave it as Default.
  • Don’t write anything in the page now, Just publish it and exit from it.

Now the note the URL of the page which for an example can be http://www.technospot.net/blogs/google-search . Make sure its valid.

page_new

Creating your Adsense code for search.


Google Adsense allows you to add a form which act as a search box for any site. But there is one constrain with Adsense Search. Your site should be indexed properly if you want search result to be displayed from your site else it can be used for normal search.Follow the steps:

  • Now login to your Google Adsense account and go to Adsense Setup > Adsense for search.
  • After entering all the details of your site and customization you will get an option like

google_adsense_option

  • Choose the third option and enter the search page URL which you created in previous step for me i.e http://www.technospot.net/blogs/google-search .
  • Now you will get two codes. One for the Search Form and other for search result code , which we will use it for our search page we created.

google_adsense_code

Understanding template and creating template file for Search Page


A template is something which can be reused again and again. In Wordpress template file can be used to add it to Pages. So when the page is called it uses the template along with it. Here we will create template file called as “Search.php”

  • Create a template file named as “search.php” on your desktop.
  • Now add the below code into it.

search_template

  • Insert the Adsense code for Search Result inside the commented area.
  • Note remember to call header, footer and sidebar. And preferably add your code in the content part.
  • Upload the file into the theme folder which you are currently using.
  • Download the above code from here search.txt (rename it as .php file before uploadling)

Changing the template of search page.


  • Edit the page we created in first step.
  • You can see the template in right sidebar. Click on it and you will be able to see the template name “search” which you uploaded.
  • Select it and save the page again.

page_new_search

Now add the search form wherever you want on the blog. And if anybody makes a search, the result should be displayed in the search page we created.

How do you make money from Adsense Search Box ?


Some sponsored results are displayed when a search is made on using the above arrangement. If anybody clicks on it you get paid. But remember ads are not showed every time and if there is an exact match with your site result people will go to your site Thus the visitors stay on your site and you make some money out of it too.I hope this can help a lot of bloggers on self hosted Wordpress blogs. If you like it link it in your posts and tell others about it. :D.


Vote This Post DownVote This Post Up (+5 rating, 1 votes)
Loading ... Loading ...
Comment or Discuss

About The Author of this article:
Ashish is one of the co-author of this blog and writes on various interesting softwares, PC tips and more. You can read more of his articles here.

Enjoyed this article? Download our Toolbar ( for Free ) and read us more quickly or Free Subscribe to the Full RSS Feed or Get Post like this in your Inbox Click to get via Email ( You will have to confirm by checking you Inbox)


  • Tags: , , , ,
  • Read More Stories from Adsense, Blog-Tips

  • 12 Comments and Link-Backs to “How to implement Google Adsense Search in Wordpress blog and make money

    Click Me and Jump to Add your Comment :)

    10 Comments from Friends and Readers

    • Shankar Ganesh, October 3, 2007:

      :-O This is pretty different from another guide I saw the other day. Thanks a lot for this tutorial, I’ll try it :)

    • Ashish Mohta, October 3, 2007:

      @Shankar: Whats the difference you found ?

    • Shankar Ganesh, October 4, 2007:

      Well, here you’re using the adsense account, whereas in the other guide I found, the CSE had to be created via google.com/coop something. Nothing much.

      This is a straight guide though :)

    • Ashish Mohta, October 4, 2007:

      Cool Shankar, Then I created something different :D

    • Website Design, October 5, 2007:

      Nice, very thorough walk through. Being that most people are now blogging with the hopes of making money, this is more than timely. Great post.

    • Jiwei, November 17, 2007:

      Great guide. Everything worked like a charm as per instruction, except one bug. There should be only one in the search.php in some themes (e.g. mine), because the side bar is part of the id=”left”.

      Thank you very much.

    • Ashish Mohta, November 18, 2007:

      @Jiwei: Thanks . Yes ur right. You will need to work around to fit it in your template.

    • The process is quite easy , I tried on my other blog and it worked smoothly. Adding custmized Google search page to blog gives it more professional look.

    • Ashish Mohta, February 9, 2008:

      Hi Rajeev,

      Thanks for the feedback and great it worked. I discovered the process little hard way so thought of making it availble to others in an easy way. And yes it does make site very proffesional. Do tell us if its add advanatage and gives good performance to your site. 

    • James, August 18, 2008:

      Thanks, worked perfect. 5 Rating…….

    2 Trackbacks/Pingbacks - Other blogs referencing this article

    Leave a comment Share your thoughts with the world

    Scroll Down and Check footer for more details



    • Recent Comments:

      • michael: how do you do this on vista? i saw a commnet referring to this but i couldnt find where you wrote the answer
      • Jahad: hi is there a way of removing this as i installed it but a certain game wouldn’t run without directx...
      • AaronTigno: i got the (The application for project ‘C:\Program Files\Microsoft DirectX SDK (April...
      • pitas: very good
      • kimmy: U can also try this web site:http://www.freesmsfrompctomobile.co m
      • Fernando: I started using this over the weekend with my son’s laptop. Unfortunately the problem I found with...
      • Garth: I’ve seen a better solution that does this and much more. Check out http://roohit.com It is so versatile...
      • VLadimir: fefewf
      • Ricardo Ferreira: I would rather kill myself than buy windows, good lord, lock me up already, viva le Pirate Bay!
      • Busnut: Great buzz about Drop Box. Please send me an invite.

    Technology Blogs - Blog Top Sites