Today, I had a WTF moment when I was adding AdSense code to theme. Naturally, I install Wayne’s AdSense-Deluxe Plugin for WordPress to make it easy on myself. I’ve made the choice simply because AdSense-Deluxe Plugin is the best plugin out in the WordPress plugin jungle (more about that in later post).

In the past, I have been avoiding ads in posts on my other blog that I either participate or have helped to setup. All for the name of unintrusive ads, in fact too unintrusive… This time around I wanted to be a little bit bolder in my ads arrangement. However, I did not want those post ads to show up in my home page, archive pages, or any non-single pages in the blog. Ahh… Good! AdSense-Deluxe allows me to turn them off with just a few clicks to unchecked the related check box.

Then I saw it.

Alignment off cause by extra divs

WTF is there a gap screwing up my alignment?!

A closer look

As it turns out, I wanted to make the post text wrap around the ads. Also to place a little more space around the ads so that my post text will not be too close to the ads. Without thinking, I went ahead to add a pair of DIVs around the AdSense-Deluxe commented codes in the post. Well, AdSense-Deluxe did its job by not replacing the HTML comment with AdSense code, but that leaves a pair of empty DIVs that naturally takes up space…

At this point, I was still in the WTF moment, franticly digging into AdSense-Deluxe code to see if I can somehow fix it to also handle the pair of DIVs around the AdSense code block. Should I hack it to use a special form of the comment code so that AdSense-Deluxe will recognize how to add the pair of DIVs around the AdSense code blog? I was thinking to myself.

It was only after a few hours that I realized that WTF! I could just add the pair of DIVs along with the AdSense code block in the AdSense-Deluxe options page! WTF do I need to place the pair of DIVs in the post!?

<div class=”adsclass”>< … adsense block …></div>

Talk about feeling stupid…