Code Snippets

Add Google Content Ads Between Your WordPress Search Results

I have been thinking about the best way to display ads on my WordPress blog search results for a long time because there are numerous options. You could just display content ads at the top, bottom, or both locations, you could add a WordPress plugin, or you could create a custom page with Google custom search results geared for your page. I played around with the latter two options but wasn’t happy with eaither result. One of the ways to do the Google custom search results is using an iFrame and iFrames suck. Anyway I decided to add some custom PHP code to display the ads however I ran into a problem quickly which was the fact that you can only display 3 of the same ad on any one page so if you want to display ads in between each search result it would get a bit more tricky.

Technology Insights

Add Google Adsense Ads to WP-PDA WordPress Plugin

It is fairly easy to add Google Adsense ads to the WP-PDA plugin for WordPress. If you follow the easy steps below you will have Google ads showing up in no time with WP-PDA. You will be required to edit the source code for the WP-PDA WordPress plugin so make sure to back things up before you start. One thing to note is the fact that you can only have one Google Mobile Adsense ad at a time currently.

Adding Google Adsense Ads for WP-PDA iPhone/Touch Browsers:

  1. Backup Files: Backup any file before you attempt to modify it.
  2. Create Google Adsense for Mobile: Visit this link and follow the instructions to create the Google Adsense ad for your mobile content. Be sure to specify PHP for the last step.