Forums

WP125 Need to Rotate Ads bith out using Widget (4 posts)

  1. rsaw3rd
    Member
    Posted 2 years ago #

    I need to rotate out the ads on my site as well, but not using awidget due to layout, I followed the above example and used the code <?php $num = rand(1,6); wp125_single_ad($num); ?> for each of the 6 ad spots, now sometimes, I get 4 of the same ad in the spots, how do I refine this code to only display one of each advertiser but in a different spot each ? In other words I want 3 ads across and 2 rows, then Random order. The settings only allow for 2 cols.

    Here is what I did to display ads:

    <div class="Ad-125">
    <?php $num = rand(1,6); wp125_single_ad($num); ?>
    <?php $num = rand(1,6); wp125_single_ad($num); ?>
    <?php $num = rand(1,6); wp125_single_ad($num); ?>
    <?php $num = rand(1,6); wp125_single_ad($num); ?>
    <?php $num = rand(1,6); wp125_single_ad($num); ?>
    <?php $num = rand(1,6); wp125_single_ad($num); ?>
    </div>

    site is http://www.rceno.com Ads are on Upper Right Side

  2. rsaw3rd
    Member
    Posted 2 years ago #

    Or is there a way to configure the widget to get 3 cols instead of just 1 or 2? then I could use the widget to rotate out the ads and not have to use the single ad post hardcoded into the sidebar

  3. rsaw3rd
    Member
    Posted 2 years ago #

    <<Bump>>

  4. gazouteast
    Member
    Posted 1 year ago #

    In wp125_single_ad($num); the $num is the ad SLOT number, not the ad number

    Your code simple randomised which ad slot will be used for each instance, not which ad will appear per slot

Topic Closed

This topic has been closed to new replies.

About this Topic