$49

Ad Wizard

Documentation  •  Changelog

Documentation

Embedding your ads

You have two Twig tags available to you...

Show a single, specific ad

Specify the ad by its ID number:

{{ craft.adWizard.displayAd(99) }}

Or if you're already working with an existing AdModel:

{{ ad.displayAd() }}

displayAd was previously known as "ad"

Random ad from a specific group

Specify the group by its handle:

{{ craft.adWizard.randomizeAdGroup('rightSidebar') }}

randomizeAdGroup was previously known as "position"

Both methods can display an ad until:

  • The ad expires, or
  • The ad reaches the maximum allowed impressions, or
  • The ad is manually disabled.

Get ads via an Element Query

It's also possible to collect a set of ads through an Element Query...

{% for ad in craft.adWizard.ads.group('rightSidebar') %}

    {# Do something creative with ads #}
    {{ ad.displayAd() }}

{% endfor %}

or:

{% set ads = craft.adWizard.ads.group('rightSidebar').orderBy('RAND()') %}

This is the same basic mechanism which allows you to get entries, assets, and categories in Twig. And just as you would with entries, you can apply "all", "one", or "ids" to the end.