Adding Google Search To A Wordpress Blog Tutorial
Today I wanted to touch on a adding Google search to a wordpress blog. This may take a little skill with php. So, if your not comfortable with that please have someone you trust to complete this tutorial.
Some may ask why would anyone want to do this. Well, I can think of one very important reason. When Google search is installed on a website will index all of the sites pages. This was stated on the Google Adense blog a number of weeks ago. To me that is the most important reason. Another great reason is that it is just another way to monetize a website.

Google’s search results are embedded into your website. When a visitor types in a search term Google Adsense results are returned with the search term results. This just give you another chance to gain income if the visitor does not find what he/she is looking for.
Getting Started
Getting started is pretty easy. First lets get on over to Google Adsense. If you don’t have a Google account then you will want to sign up for the program. In the top right corner you will see a button that states “Sign Up Now!!”. Click this button and go through the signup process. It will probably take a day or two to get a response back as to if you have been accepted into the program.
Once you have your login information go the the homepage of Google Adsense and log in. Once logged in look at the top of the page at the top menu. Select Adsense Setup to start the Google Search Wizard. Once the page has loaded up go to the middle of the page and select Adsense for Search.
Once selected you will be put into a wizard with 8 options for configuring the code you will receive at the end of the wizard.
Lets Begin:
Search Type - Choose what information you want to return back in the search results. Do you want the search results to have just your website pages you selected or the entire web. I always pick the sites I selected.
Selected Sites - Here you will put the domain address of the site or sites that you would like the search result to show. The sites that you select in this box will only show up in the search results along with the adsense results.
Optional keyword - If you have optional keywords that you would like Google search to find add them here.
Site Language - If you have a site that is in anything other than English then provide the language of the site here.
Your Site Decoding - Leave this as the default
Country or Territory for Google Domain - Specify the Google search engine you want the results to come from. For example if you have a UK site you would want the results to come from Google UK.
Custom Channel - I like to track were I get Adsense dollars from. This option allows you to put in a special code that will come up in the Adsense results if Google Adsense money is rewarded.
Safe Search - Safe Search is so porn is not a search result. I always leave this on.
OK.. Now you should be finished with the first page of the wizard. Now, hit continue to go to the next page.
Next it is time to select the search box. Google gives a lot of options on the page so choose a search box that will work for your individual website and get continue.
Now, here is the tricky part. It is time to go into wordpress and create a page for the search results.
So.. Log into wordpress and at the top hit the Write tab and select the Write Page

In the “Title” type in a meaning full name. For example in most of my blogs I type in “searchit” and create the page. You will have to come back to this page later in the tutorial so keep it handy.
Now you have the web address to enter into the Google Wizard. For this example it would be: http://www.marketassociate.com/searchit. Take this web address and enter it in the spot below..

Next configure the ad location. Since I use wordpress and I don’t have a lot of room in my template I always choose the top and bottom option.
Finally, configure the colors to fit your website and select continue at the bottom of the page.
It is time to get the code that will be put onto your wordpress blog. Now submit and get code.
You will now get two segments of code. The bottom segment is for the “searchit” page you created earlier.

Go back into wordpress and bring back up the searchit page. Hit the html tab and paste the Google code segment into the page. You may have to change some settings in the Google adsense code segment to fit your template.
<div id=”cse-search-results”></div>
<script type=”text/javascript”>
var googleSearchIframeName = “cse-search-results”;
var googleSearchFormName = “cse-search-box”;
var googleSearchFrameWidth = 800 400;
var googleSearchDomain = “www.google.com”;
var googleSearchPath = “/cse”;
</script>
<script type=”text/javascript” src=”http://www.google.com/afsonline/show_afs_search.js”></script>
Once done save and publish page.
The next step you will have to know a little php to complete. Because you will be changing the template code of your sight. If you are not comfortable doing this have someone who you trust finish this part of the tutorial.
Take the top code from the Google wizard and replace the search bar code on your site. In my case I replaced
<form method=”get” id=”searchform” action=”<?php bloginfo(’home’); ?>”><input type=”text” class=”textbox” value=”<?php echo wp_specialchars($s, 1); ?>” name=”s” id=”s” /><input type=”submit” id=”searchsubmit” value=”Search” />
</form>
With
<form action=”http://www.cheap-leotards.com/searchit” id=”cse-search-box”>
<div>
<input type=”hidden” name=”cx” value=”partner-pub-7592355743918011:r08qwt4k27p” />
<input type=”hidden” name=”cof” value=”FORID:11″ />
<input type=”hidden” name=”ie” value=”ISO-8859-1″ />
<input type=”text” name=”q” size=”31″ />
<input type=”submit” name=”sa” value=”Search” />
</div>
</form>
<script type=”text/javascript” src=”http://www.google.com/coop/cse/brand?form=cse-search-box?=en”></script>
on one of my sites.
And that is it. You may have to play with some color or sizes to make everything look exactly the way you want it. But after that Google takes over and provides all the results that are needed.
I hope you enjoyed this tutorial. Please visit often for more exciting information….
Popularity: unranked [?]




