AdRotate Shortcode returns value when ad not running

Home Forums AdRotate for WordPress General Support AdRotate Shortcode returns value when ad not running

  • #134386

    deconspray
    Badges:

    I am using AdRotate Version 5.8.19.

    I need to determine when AdRotate has a valid promo running; if it does, I display a banner on a listing page.

    My code works fine when the AdRotate shortcode is in place. However, even when the AdRotate ad is not running, a value is seemingly being returned, thereby triggering my conditional to display a banner when there’s no promo running. Is there a way of returning no value (null) from the shortcode when there is no scheduled promo running?

    Here’s my code:

    <?php
    $promo = get_field('itinerary_promo');
    $promosc = do_shortcode($promo);
    if ($promosc) { ?>

    <div class="offerindicator">Special Offer</div>
    <?php } ?>

    #134414

    Arnan de Gans
    Badges:

    I’m not sure what you’re trying to do, but AdRotate (Pro) shortcodes either output an advert or a notice why the advert can’t show.

    #134416

    deconspray
    Badges:

    Correct. My inquiry surrounds the “a notice why the advert can’t show.”

    The actual content within the AdRotate ad appears on a detail page. What I’m attempting to do is to display something like “Special Offers” on a category listing page that links to that detail page. The conditional that determine whether there is an active ad is looking to see if there is a value returned. As there is something returned no matter whether an ad is active or not, that is the problem I am attempting to overcome. If there was a way to turn off the value which is a notice why the advert content cannot show, or determine what that value is, I could then use that for my logic for the “Special Offers” banner on the listing page.

    #134417

    Arnan de Gans
    Badges:

    Looks like you have to come up with some custom function for that 😉

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

You may be interested in