AdRotate – Groups

Groups are useful if you use multiple locations or pages for ads showing different categories/niches or sizes of adverts. Most people will want to set up a group for each location. Or perhaps even several groups. Groups can hold one or many adverts. If you put multiple adverts in a group it will automatically show different adverts on a regular basis.

Group modes

Groups serve multiple purposes and can operate in different modes depending on your needs.

Currently a group can be 1 of 2 modes:

  • Default One advert at a time and requires a page refresh for a new one to load.
  • Block Show a grid of multiple adverts on your site.

A group can operate in one mode at a time and can have as many ads as you need. Depending on your settings these will rotate and be picked at random. This is a semi-random process. You can influence the randomness with Advert settings such as weight, geo-location and schedules.

Block mode

Block size

This option is for block mode and determines the grid you’re making. Think of it as a spreadsheet.
Rows go horizontal, columns vertical.

Advert size

This option is used for Block mode and sets some rules for the adverts. The size in pixels for the advert is determined this way and directly influences a grid of adverts in Block mode.


Advert Margin

Set a margin around your adverts to create some space between them.

Group Align

In most themes you can align the group with this function.
Keep in mind that this does not always work. Some themes think they should control those things. In that event you need a custom solution with CSS.

Geo Location

If you have adverts with Geo Location enabled in the group and you want that to work for those ads enable this setting. This enables the Geo Targeting filter.

Mobile Adverts

If you have mobile adverts enabled and you want the group to follow the device limitations you set for the adverts you have to enable this option too. This enables the mobile filter.

Fallback group

Set a fallback group. This fallback group generally has some generic adverts that do not expire. This can be a backup AdSense advert or your own advert selling the space it shows up in.
Note: Do not select the current group as the fallback group and the fallback group can not have it’s parent group as a 2nd fallback. This may create an infinite loop.

Post Injection

This includes the group in categories posts and or pages of your choosing without touching code, widgets or shortcodes.
More information on Post Injection can be found in the Post Injection manual.

Wrapper code

This is an advanced feature where you can add special code, specific to the group, around each advert. You’ll need HTML and/or CSS knowledge to effectively use this option.

Block mode

This is a special option for groups and shows multiple adverts at the same time in a grid-like fashion.
Using the options in the group you can make advanced setups like for example; a single file column of 10 adverts in your sidebar or a 2×2 square of button adverts.

For example: If you want a 2×2 block of 125×125 ads but each ad has a margin of 10px. In your theme that translates to 125px + 10px = 135px by 135px. In the 2×2 grid the total block size will be 270x270px.
AdRotate calculates all that by itself based on your settings but your theme is ignorant for these numbers and won’t budge. So make sure things fit in the area you want the group to show up in.

Customize the look

Each group has distinct CSS classes in the shape of g-(int), b-(int) and a-(int). The (int) is the group or advert ID.

Example for group 1 with advert 1:

.g-1 { border: 1px #8983d8 solid; }
.a-1 { background-color: #f00; }

Example for group 1 (in block mode) and advert 1:

.b-1 { margin: 2px; }
.a-1 { border: 1px dotted #fefefe; }

Note: The .g-1 class is for the group with ID 1. Group ID 2 will have a class .g-2 and so on. This allows for very specific customization. The names are obfuscated a bit to try and fool Ad Blockers into thinking it’s regular code instead of adverts.
Note: AdRotate has a few adblocker avoiding features. Using the Adblock Disguise feature will change the class names to further obfuscate the outputted code.