Support » Plugin: Ad Inserter - Ad Manager & AdSense Ads » Only show banner once when using rotation

  • Hi

    I’m new to this awesome plugin. I have 9 ad banners and I want to view one banner between every posts on the homepage in random order. I have placed this in one block:

    BANNER#1
    [ADINSERTER ROTATE]
    BANNER#2
    [ADINSERTER ROTATE]
    BANNER#3
    [ADINSERTER ROTATE]
    BANNER#4
    [ADINSERTER ROTATE]
    BANNER#5
    [ADINSERTER ROTATE]
    BANNER#6
    [ADINSERTER ROTATE]
    BANNER#7
    [ADINSERTER ROTATE]
    BANNER#8
    [ADINSERTER ROTATE]
    BANNER#9

    This results in one banner between every post and in random order, but some of the banners are shown more than once and some banners aren’t shown at all.

    How do I manage to only show the banners once in random order?

    Thanks
    Torben

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Spacetime

    (@spacetime)

    The code above is for ad rotation – one random ad at one specific position:
    https://adinserter.pro/code-editing#ad-rotation

    Ad Inserter supports also counting – to insert different ads when there are multiple insertions on the page. For this separate the ads with [ADINSERTER COUNT] – Ad Inserter will select one ad according to the insertion counter:

    BANNER#1
    [ADINSERTER COUNT]
    BANNER#2
    [ADINSERTER COUNT]
    BANNER#3
    [ADINSERTER COUNT]
    BANNER#4

    However, for each position it will always insert the same banner – according to the defined order.

    I will consider possible options to randomize order for cases like yours.

    Hi Igor

    Thank you for quick answer. Unfortunately it doesn’t seem that the insertion counter works with my theme.

    When I follow the example about ad counting at https://adinserter.pro/documentation it inserts all the images between both post 1 and 2, between post 2 and 3, and between post 3 and 4 🙁

    My theme is Jarida: https://themes.tielabs.com/docs/jarida/

    Plugin Author Spacetime

    (@spacetime)

    Looks like a bug.

    Will check and try to implement random order.

    Cool, thanks. I’ll keep my fingers crossed in hope of a fast solution 🙂

    Plugin Author Spacetime

    (@spacetime)

    The latest development version should work in your case.
    I have also implemented shuffling of ads when using COUNT separator.

    Please install development version:
    https://downloads.wordpress.org/plugin/ad-inserter.zip

    BANNER#1
    [ADINSERTER COUNT="shuffle"]
    BANNER#2
    [ADINSERTER COUNT]
    BANNER#3
    [ADINSERTER COUNT]
    BANNER#4

    Please note that only the first count separator contains value “shuffle”.

    Cool. I’ll check asap and return to you with my experiences. Thumbs up!

    Plugin Author Spacetime

    (@spacetime)

    The plugin has been updated so you can simply update to 2.2.14.

    Yes, I have noticed!
    And more important: I checked it and used this PHP snippet to make the dynamic shortcode with [ADINSERTER COUNT=”shuffle”] only in the first counter separator:

    <?php 
        $params = array( 
            'where'   => 'annoncetype.slug="tekstbanner"', 
            'limit'   => -1 
        ); 
    
        $annonce = pods( 'annonce', $params ); 
        $count = $annonce->total();
        $i = 1;
    
        if ( 0 < $count ) { 
            while ( $annonce->fetch() ) { 
    ?> 
            <a href="<?php echo $annonce->field( 'klik_url' ); ?>" target="_blank">
            <img src="<?php echo $annonce->field( 'banner._src' ); ?>" /></a><br />
            <?php
              if ( $i == 1 ) {
              echo '[ADINSERTER COUNT="shuffle"]';
              }
              elseif ( $i < $count ) {
              echo '[ADINSERTER COUNT]';
              }
              $i ++;
            } 
        } 
    ?>

    THANK YOU SO MUCH. I REALLY APPRECIATE YOUR HELP 😀

    Plugin Author Spacetime

    (@spacetime)

    Great!

    THANK YOU SO MUCH. I REALLY APPRECIATE YOUR HELP

    Please say it here:
    https://wordpress.org/support/plugin/ad-inserter/reviews/

    Thank you 🙂
    Igor

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Only show banner once when using rotation’ is closed to new replies.