Text Link Ads
Email This Post Email This Post

How to Insert Random Affiliate Banners

Wordpress, Affiliates September 3rd, 2007

    Visited 411 times, 1 so far today

There are many affiliates that require you to use banners (468×60) which don’t fit on a sidebar. Affiliates such as text-link ads, blog mastermind and amazon all provide these banners that you can display on your pages. If you are an affiliate for several sites like me, then the last thing you want to do is to stick banners all over your home page - this can be a real turn off as it gives people the impression you are just advertising and it can make your site look too spammy.

I found the solution and it’s easy! You can add a random affiliate banner anywhere on your site by simply writing some code into your template file. I’m going to show you how to insert random affiliate banners on all your pages just above the posts. To do this you will need to edit the template files index.php, archive.php, page.php and single.php. You can display as many affiliate banners as you want to. To see a demo of this you can see the way I have done it on this site.

Here is the code and step by step instructions on how an where to inset it. Good Luck!

  1. Login to your WordPress administration panel
  2. Select Presentation ->Theme Editor from the navigation menu
  3. On the Theme Editor page, you will see a list of “theme files” to the right of the page. Select the “main index template” (index.php).
  4. Find the following line
    <div id=”primaryContent”>
  5. Below it copy and paste the following code
    <?php$show = rand (0,3);

    switch ($show) {
    case 0:
    ?>
     <a href=”1st affiliate url goes here”></a><?php
        break;
    case 1:
    ?>
     <a href=”2nd affiliate url goes here></a>
    <?php
        break;
        case 2:
    ?>
    <a href=”3rd affiliate url goes here”></a><?php
        break;
    case 3:

    }

    ?>

  6. Save

You can view your site now and you should be able to see 3 random affiliate banners on your home page just above the posts.

You need to now repeat the above steps 1- 6 on the following template files:
archive.php - this will show the banners on all your category pages
page.php - this will show the banners on all your pages you create in Wordpress
single.php - this will show the banners on every single post

That’s it your done :)
 

Leave a Reply


             



Resources

Categories

FREE Newsletter

Sign up TODAY and get FREE Tips every Week on Making Money on the Internet 

(required)
(required)
 

Increase your Blog Traffic


     

Auction Ads


     

Recommended Book


      

Tag Cloud

Wordpress Blog Marketing Blogging Tips Blogging Tools and Services Advertising VoIP Blogging for Money Search Engine Optimization Adsense General

Recommended Money Makers


    
      Text Link Ads
      Blog Mastermind Affiliates
      AuctionAds
      Amazon Associates

Related Articles

Recent Articles

Advertisements