HowTO: Place Ad Unit in Your Blog-Part II

In the previous post, we talked about placing Ad units within single post. And now I`ll talk about placing Ad units in pages(home, category, archives..etc). For this, you may take a look on “The Loop” Document to understand how WordPress deal with posts and pages.

There`re several places that you may put your Ads in, for example above, bellow and between posts in home page or in your sidebar..Actually it depends on your theme and design(2columns, 3columns, full width blog..etc) . So if you are using a public theme try to find other people who use the same theme and see how they blend their ads and if you designed your theme your self..then I guess you don’t need anyone to tell you where to put your ads,do you?!

To add your Ad units to your blog you should first see what kind of Ads format you want to show just like in placing Ads in a single post. After that you should consider your blog design and see where are the best places..just open your blog and take a look for 2 minutes, I believe you`ll start get some ideas where to put your Ads. You may find these tips helpful:

  1. 2 Columns Blog:
    If your blog is 2 columns blog and you have a lot of links in your sidebar then it`s a bad Idea to put a Text Ad unit in the sidebar. Link Units will be the best choice, e.g. QuickOnlineTips.
  2. 3 Columns Blog:
    I was using a 2 columns theme and I had problem adding my Text Ads since the only place was between posts..so I had to change my theme to 3 Column to put a Skyscraper in the right sidebar..which fit perfectly. So I think you get it..another column = space for Text Ads
  3. Full Width Blog:
    In Full Width blog the font is usually bigger than normal and there`ll be more blank space so adding Wide Skyscraper, Large Rectangle or Leaderboard will be easy.
  4. Narrow Blog:
    If Narrow/non-full width blog is the case -as my blog-, then Banner, Medium Rectangle or Square Units will be your choice.

P.S. Tips above may not be correct in some cases, since it depends on the design of your blog!

How To Place Ad Units Between Posts?

The answer of this question is easy..and Raj posted a nice tutorial called “Conditional Display of AdSense and other Ads in WordPress” about it. Honestly I had some problems following his tutorial. Anyway, this is my code:
As in Raj tutorial you create a counter and set it to zero before the loop start, then the counter should increment by 1 whenever one loop ends
<?php $postnum = 0; if (have_posts()) : while (have_posts()) : $postnum = $postnum + 1; the_post(); ?>
and since I don’t have a Single page template the condition and the code will look like

<?php if (2 == $postnum && !is_single()) { ?>
<br/>YOUR Ad Unit Code or Adsense Deluxe PHP command goes here!
<?php } ?>

As you can see here the Ad unit will appear after the second post.

P.S. You may need to put lines/borders to separate your Ads, so these kind of modifications will be inside the IF statment.

Also you may add your Ad code before/after the posts’ Loop, which can be done by pasting your Ad code directly or add it to a Conditional statement before/after the loop which will be the case if you don’t have a Single page template(for example)..so your code may go between this “conditional-testing statement”

<?php if (!is_single()) { ?>
<br/>YOUR Ad Unit Code or Adsense Deluxe PHP command goes here!
<?php } ?>

And that`s it :)
Did you find this post helpful?

If you found this post helpful, Subscribe to Enblogopedia today!
Add Enblogopedia to your Technorati favorites.

Related Entries

Your Ad Here

Comments

3 Responses to “HowTO: Place Ad Unit in Your Blog-Part II”

  1. Madhur Kapoor on December 28th, 2006 10:03 am

    Great article man … i have always wondered about these things ..

  2. admin on December 28th, 2006 12:42 pm

    Hey man thanks for passing by!
    Glad you find it helpful! ;)

:: Trackbacks/Pingbacks ::

  1. Pingback by HowTO: Place Ad Unit in Your Blog-Part I - enblogopedia.com - on December 23rd, 2006 at 9:11 pm

Leave a Reply