Creating groups

Difficulty: Easy | Updated: November 24, 2015

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 one of three modes:

  • Default One advert at a time and requires a page refresh for a new one to load.
  • Dynamic One advert at a time which refreshes to a new advert every so much seconds.
  • Block Show a grid of multiple adverts on your site.

A group can operate in one mode at a time and can have as much adverts 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.

Dynamic and 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 both Dynamic and 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.
For Dynamic mode it serves mostly as a height limit so the rotation and fading effect looks good.

Automatic refresh

Used for Dynamic mode and sets the amount of seconds for each advert to show.


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

Pro Feature

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.
AdRotate makes it easy on you and uses WordPress hooks to add the adverts automagically.
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 customisation. The names are obfuscated a bit to try and fool Ad Blockers into thinking it is regular code instead of an advert.

Note: AdRotate has a few adblocker avoiding features. Using the Adblock Disguise feature will change the class names to further obfuscate the outputted code.

Back to AdRotate Manuals

You may be interested in