Left Align AdSense 336 Ad in WordPress

WordPress doesn’t make it easy to align your 336 ads and though plugins exist, they too seem to have a difficult time with placing a 336 ad where you want it (in regards to left or right align).

For an easy approach, I like the following:

Download and install this adsense plugin into WordPress.

After installation and activation, go to ‘Settings’ and click on ‘Adsense’. Insert whatever AdSense codes you wish to use (12 different options are available).

AdSense Insert

Next.. simply follow the on-page instructions for inserting code. You can use shortcodes directly in WordPress or echo (php function) the AdSense code directly in your theme’s template files. I prefer to do this.

As an example, if you want to left-align a 336 ad at the beginning of every post, simply go into single.php and find where the content of the post is being displayed:
<?php the_content(); ?>
Echo your 336 ad right above this with the following:
<?php echo show_ad_1(); ?> // for the first ad

Next up.. we want to left-align the ad. So right before the previous line, insert the following:
<p class="alignleft" style="text-align: left; margin: 8px; float: left;">

and right after the php line, be sure to close the paragraph:

That’s it! All posts will now contain a left-aligned 336 AdSense unit.

Here’s the final code in my single.php file, and I’ll include the h1 tag that already exists in my single.php page, which means I’m simply inserting this right after my post title:

<h1><a href="<?php the_permalink() ?>"><? php the_title(); ?></a></h1> <p class="alignleft" style="text-align: left; margin: 8px; float: left;"> <?php echo show_ad_11(); ?> </p>

There’s a lot of different ways to use the plugin, as instructed on the plugin page, so play around and get your ads setup exactly as you want.


  1. Thanks for this piece of code. I was wondering just how to do that. One thought though I saw differences in behavior when viewing the blog on different devices – Windows desktop and iPad for example even before applying the fix you suggest.

  2. Alik,
    Thanks for the heads up. I haven’t checked anything on my ipad/iphone but I’ll give it a go and see if it needs a little code massaging.

Submit a comment

CommentLuv badge

reverse phone lookupTattoo DesignsSEO
My New Amazon Script Is Close!
A new php script for sale is coming!
Sign up to get notified