Home » Wordpress21 November 2008

Left or Right Align your image, adsense code or other advertisement in wordpress

Suppose you want to show your google adsense in the top-left side of your post. If you simply put your adsense code in the single post page (single.php) of wordpress then the text of your post will appear below the adsense.

To solve this problem, I used stylesheet property called ‘margin’. The example below is from single.php file of my wordpress theme. The adsense code is kept in between the paragraph tag.
It is kept after <div class=”entry-content”> and before <?php the_content(); ?>

Similarly, I created an about me page. I wanted to show my pic in the top-left position and to show the text by the side of the pic. For this I added style to my uploaded image while editing the page. I went to the HTML (not View) section in the edit/add page.

The style I added goes like this:

More HTML source from my about page:

Hope it helps. Thanks.


Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • the align code worked perfect for my adsense thanks

  • Really great info man, thanks a bunch!

  • thanks for the tutorial i managed to setup adsense ad at my blog