1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Sidebar ads only showing on Index

Discussion in 'WordPress' started by MhW, Apr 13, 2010.

  1. #1
    Hi everyone,

    I'm having a little problem. I've got a little PHP code rotating some Ads in my sidebar:
    <?php 
    $random_number = rand(1, 4);
    
    $random_banner[1] = 'banner 1 code';
    $random_banner[2] = 'banner 2 code';
    $random_banner[3] = 'banner 3 code';
    $random_banner[4] = 'banner 4 code';
    
    echo "$random_banner[$random_number]";
    ?>
    PHP:
    Only problem is the Ads are only showing on the Index page. When I visit pages or posts it disappears. This also happens if I change from PHP to a JavaScript equivalent.

    Is this a common issue I'm missing out on? :confused:

    You can see the problem in action at my site: http://wp.christianbullock.com/ (The Ad below the "About me" block).

    Thanks :)
     
    MhW, Apr 13, 2010 IP
  2. s_ruben

    s_ruben Active Member

    Messages:
    735
    Likes Received:
    26
    Best Answers:
    1
    Trophy Points:
    78
    #2
    Check the image files. Is there image "wp-content/themes/letterpress/images/3d1.gif"?
     
    s_ruben, Apr 13, 2010 IP
  3. lukeg32

    lukeg32 Peon

    Messages:
    645
    Likes Received:
    19
    Best Answers:
    1
    Trophy Points:
    0
    #3
    lukeg32, Apr 14, 2010 IP
    MhW likes this.
  4. deluxdon

    deluxdon Catch Me If You Can...!!!™ Staff

    Messages:
    25,480
    Likes Received:
    1,943
    Best Answers:
    32
    Trophy Points:
    480
    #4
    If you are using any kind of plugin for displaying your ad then check it out its options as maybe there is an option like 'homepage only','all pages' etc.

    DON.
     
    deluxdon, Apr 14, 2010 IP
  5. MhW

    MhW Active Member

    Messages:
    370
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    85
    #5
    You were right :). I tried being fancy and using a short image path to keep the file tidy, but as you pointed out the path to image changed when I left the index page.

    Got it sorted now, thanks for your help :) (+ rep) .
     
    MhW, Apr 14, 2010 IP