Google Adsense for Search: Embed Results in WordPress

Google AdsenseWhile I did quite a bit of template work on WordPress this weekend, I saw a note about embedding your Google Adsense for Search results within your Search Results page. This is pretty simple if you have a static website, but working within WordPress it's a little more difficult. Thankfully, Google did a nice job (as usual) with writing some nice clean scripts to embed the results.

I simply edited my “Page” template and inserted the code that Google requires for the landing page. I have the search results posting to my search page ( Then, I updated my Search page with the search form (with some minor edits of course).

The script that Google supplies is intelligent to only display if there is a post result, so my other pages do not display anything. I suppose I could have wrote an ‘if statement' that only displayed the results if the page equals the search page. However, I didn't bother since it won't display otherwise. I suppose it's a little bit of a hack and not proper, but it doesn't hurt anything.

My next step was to ensure that no competitors to my employer showed up on the search results! I hope I got them all!

Try it out here.

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.