<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>David&#039;s technobabble &#187; google search</title>
	<atom:link href="http://bable.cybermarshall.com/tag/google-search/feed/" rel="self" type="application/rss+xml" />
	<link>http://bable.cybermarshall.com</link>
	<description>David&#039;s thoughts about this and that</description>
	<lastBuildDate>Fri, 22 Jan 2010 18:29:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using Google Adsense for Search in Wordpress</title>
		<link>http://bable.cybermarshall.com/2009/01/08/using-google-adsense-for-search-in-wordpress/</link>
		<comments>http://bable.cybermarshall.com/2009/01/08/using-google-adsense-for-search-in-wordpress/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 00:59:13 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[google]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[google search]]></category>

		<guid isPermaLink="false">http://bable.cybermarshall.com/?p=259</guid>
		<description><![CDATA[I wanted to use Google &#8220;AdSense for Search&#8221; as the default search engine on my wordpress site. After experimenting with several of the wordpress plugins to set up the Google Search, I just wasn&#8217;t satisfied with any of them. So I asked myself: &#8220;Why couldn&#8217;t I do something like I&#8217;d been doing with plain old [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to use Google &#8220;AdSense for Search&#8221; as the default search engine on my wordpress site. After experimenting with several of the wordpress plugins to set up the Google Search, I just wasn&#8217;t satisfied with any of them. So I asked myself: &#8220;<em>Why couldn&#8217;t I do something like I&#8217;d been doing with plain old website</em>s&#8221;? It turns out that I could and I ended up with something that seems pretty simple, to me.</p>
<p><span id="more-259"></span></p>
<p>My reservations with the existing plugins had to do with modifying code in the theme. Although, I&#8217;m more than capable to modify the theme, I did not want to remember to do so every time I changed or upgraded my theme.</p>
<p>When you setup Google &#8220;AdSense for Search&#8221; on a plain old website, you:</p>
<ul>
<li>create a search results page that contains the &#8220;Search Results Code&#8221; JavaScript that is generated by Google.</li>
<li>create a search button on the pages of your website, using some more Google generated JavaScript code.<br />
This is done by placing the &#8220;Search Box Code&#8221; JavaScript that is generated by Google on the pages of your website where you want the search button to appear.</li>
</ul>
<p>Much to my surprise, this turned out to have a fairly direct translation to wordpress. It seemed pretty simple to do.</p>
<p>First, I setup my Google &#8220;AdSense for Search&#8221; which created 2 JavaScript code blocks: &#8220;Search Box Code&#8221; and &#8220;Search Results Code&#8221;</p>
<p>Next, I created a search results page for my site. Making sure that my permalink was in the format of http://mysite/search and then in source view I added  the Google generated JavaScript code for the &#8220;Search Results Code&#8221; from my &#8220;AdSense for Search&#8221;. This will look something like:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?" onclick="pageTracker._trackPageview('/outgoing/www.ericbess.com/ericblog/2008/03/03/wp-codebox/_examples?referer=');"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p259code3'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2593"><td class="code" id="p259code3"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;&lt;!--</span>mce<span style="color: #339933;">:</span><span style="color: #CC0000;">0</span><span style="color: #339933;">--&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>script src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;http://www.google.com/afsonline/show_afs_search.js&quot;</span> type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;&lt;!--</span>mce<span style="color: #339933;">:</span><span style="color: #CC0000;">1</span><span style="color: #339933;">--&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Last, I removed the standard wordpress &#8220;Search&#8221; widget. I created a new Text widget and placed the Google generated javascript &#8220;Search Box Code&#8221; from my &#8220;AdSense for Search&#8221; into the text of the new widget. This will look something like:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?" onclick="pageTracker._trackPageview('/outgoing/www.ericbess.com/ericblog/2008/03/03/wp-codebox/_examples?referer=');"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p259code4'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2594"><td class="code" id="p259code4"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>form id<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;cse-search-box&quot;</span> action<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;http://mysite/search/&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>input <span style="color: #000066;">name</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;cx&quot;</span> type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;hidden&quot;</span> value<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;partner-pub-xxxxxxxxxxxxxxx:yyyyyyyyy&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>input <span style="color: #000066;">name</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;cof&quot;</span> type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;hidden&quot;</span> value<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;FORID:10&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>input <span style="color: #000066;">name</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;ie&quot;</span> type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;hidden&quot;</span> value<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;ISO-8859-1&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>input <span style="color: #000066;">name</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;q&quot;</span> size<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;32&quot;</span> type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>input <span style="color: #000066;">name</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;sa&quot;</span> type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;submit&quot;</span> value<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Search&quot;</span> <span style="color: #339933;">/&gt;&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>form<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>script src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;http://www.google.com/coop/cse/brand?form=cse-search-box&amp;amp;lang=en&quot;</span> type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;&lt;!--</span>mce<span style="color: #339933;">:</span><span style="color: #CC0000;">2</span><span style="color: #339933;">--&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Then I made my new search widget which was named &#8220;Text&#8221; the first listed widget.</p>
<p>This seems to work pretty well.</p>
<p>Maybe in a future release wordpress will let me give user controlled names to my text widgets. I currently have 3 widgets named Text <img src='http://bable.cybermarshall.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><center><script type="text/javascript"><!--
google_ad_client = "pub-5633552336244805";
google_ad_slot = "5649858591";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</center></p>
]]></content:encoded>
			<wfw:commentRss>http://bable.cybermarshall.com/2009/01/08/using-google-adsense-for-search-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
