previous post
(Photo Cards – More Than Just...)
Apr 07

So, we recently figured out how to display a Google Search Result inside of your WordPress blog using MightHitter’s MightySearch plugin.

The problem is Google’s Terms of Service won’t allow you to display google ads on the same page as your google search results:

AdSense for search results pages may show only a single ad link unit in addition to the ads Google serves with the search results. No other ads may be displayed on your search results page.

The solution is to turn off your sidebar ads when you are showing your google search results page. We’ve done it on our domain names website. Try it out.

  • When you click on any of the content pages, you should see the google ads running in the side bar.
  • If you type something into the google search form, the results should show up in the WordPress blog and the google ads in the sidebar should disappear.
  • If I’ve made a mistake, let me know so I can fix it!

We used 3 different plugins to get our Google Search Results in our wordpress blog and to have those Google Ads turn off when we are displaying our search results.

Here’s how we did it.

Step 1. Use an AdSense Plugin to position your google ads in your WordPress blog

  • We use Martin Fitzpatrick’s AdSense Manager plugin to position our google ad blocks. (I see he’s got version 3.x. We’re still on version 2.5. I suppose we should upgrade one day, but if it ain’t broke…)
  • We created an ad block called sidebar to create a vertical skyscraper ad to use in our, well, sidebar.

AdSense Manager Screenshot

  • For now, we can display this adsense manager sidebar ad as a widget

Sidebar Widget with AdSense Manager Ad

Step 2. Use the MightySearch Plugin to get Google Search Results displaying in your blog.

  • We use the MightySearch plugin to display a Google Search Results page in our wordpress blog. For now, call your Google Search Results page something obvious, like “Google“.
  • When your Google search results display in your blog, your AdSense Manager widget is always displaying ads, and so you’re breaking Google’s Terms of Service. What we need to do is turn off the ads whenever we are on the Google Search Results Page.

Step 3. Use PHP code to hide the sidebar ads when you are on the Google Search Results Page. (You’ll need something like Exec-PHP to run PHP code in your sidebar widgets…)

  • Take off the Ad#sidebar widget and add in a regular text widget. Paste in the following code:
<?php if (is_page('google')) { ?>
    <!--don't display google ads-->
<?php } else { ?>
    <?php adsensem_ad('sidebar'); ?>
    <!--display Adsense manager ad called sidebar-->
<?php } ?>

Text Widget with Code to turn off the Google Ads

  • Change the names google and sidebar to match whatever you called your Google Search Results page for the MightySearch plugin and whatever you called your sidebar ad block in AdSense Manager. (This php code will only displays the sidebar ads if you are not on the page named google)
  • PHP code in your WordPress blog won’t work unless you have a plugin installed to run it. We use Soren’s Exec-PHP plugin, but you can use whatever you want. Just make sure your plugin can run PHP code in the widgets or you’ll get an error.
  • Now, when you do a google search on your wordpress blog, the Google ads in the sidebar should turn off.

Bottom Line: If you’re comfortable with plugins and a little bit of code doesn’t scare you, then you should be able to get your Google Search Results displaying in your wordpress blog and turn off any other google ads so you don’t violate Google’s TOS.

Question: I’m a geek. I like messing around with stuff like this. Does anyone have a simpler way to turn off the Google Ads when you display a Google Search Results page? Does anyone even bother to display a google search results page in your blog?

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a Reply

Related Posts

ss_blog_claim=b734c69ef5a7cfe5ec76e92a2b196f51