Half-a**ed Adsense
It's official, I switched to the dark side. Not only does this blog has ads but they are Google's adsense. But hey, you gotta try.
Because I was so hesitant and have been postponing this moment for years, I only did it half-way. I added a condition - only show ads when displaying a single blog post and if the post is older than 30 days. This way if you follow this blog regularly by RSS or any other way, you won't see ads when posts are published.
So here's the code in case it's useful for someone. The code is not a wordpress pluggin, I only modified the "Single page" template.
<?php // 1/2-ass adsense if (time() - strtotime($post->post_date) > 30 * 24 * 60 * 60) { ?> <div style="float: right; padding: 20px"> <script type="text/javascript"><!-- google_ad_client = "pub-8608773432853916"; /* 250x250, created 5/18/08, first phpied test */ google_ad_slot = "4896717118"; google_ad_width = 250; google_ad_height = 250; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script> </div> <?php } // end adsense ?>
Basically it's the adsense-generated code wrapped in a div so I can float it and then wrapped in a condition that compares today's timestamp with the post's date.
Let's see what happens, maybe tomorrow I'll wake up rich. Or famous. Or both. ![]()

May 18th, 2008 at 3:20 pm
That’s pretty lick, and so simple, even I didn’t think of that one lol. Hopefully Google doesn’t mind, although I don’t see why they should…
May 18th, 2008 at 11:12 pm
Ya greedy bastard … Just joking
I like what you’ve done — putting your regular readers out of the “adsense experience”.
May 19th, 2008 at 11:04 am
[...] David Brooks wrote an interesting post today onHere’s a quick excerptNot only does this blog has ads but they are Google’s adsense. But hey, you gotta try. Because I was so hesitant and have been postponing this moment for years, I only did it half-way. I added a condition - only show ads … [...]
May 19th, 2008 at 3:33 pm
[...] Go to the author’s original blog: Half-a**ed Adsense [...]