Show adverts on your site

Difficulty: Intermediate | Updated: April 23, 2022

Showing adverts on your site is easy. But will require some planning and measuring. Adverts don’t fit everywhere because of some restrictions by themes. But also simply because the location is not suitable.

Always remember to place your adverts in a sensible manner and do not overdo it. Too many adverts will slow down your website and drive visitors away.

You can add adverts pretty much everywhere on your site with relative ease. The easiest method is to use widgets. Almost every theme supports widgets and some themes use them for page building also. This allows you a great deal of freedom where you place your adverts.
Another widely supported method is to use shortcodes. These are simple to use codes generated by AdRotate which you can place in your posts, pages and some text widgets.

Widgets and Blocks

Widgets and blocks are the most simple way to add adverts to a page this will be the preferred method for a lot of people. Simply drag the widget or block to the location you want it to show up and configure the advert or group ID.

Widget setup

Look for the AdRotate Advert or AdRotate Group widget and drag it to the location you want to show it in.
adrotate-widgets

Find the AdRotate Block

In the block editor simply look for the ‘AdRotate’ category or search for relevant keywords such as; banner, advert or adrotate.

Using Shortcodes

Shortcodes work on Pages, Posts and in some widgets. Some themes also support shortcodes in their text widgets or text fields.

Examples:

Single advert:

[adrotate banner="12"]

Single inline advert (This advert has its wrapper div stripped):

[adrotate banner="4" wrapper="no"]

A random advert from a group:

[adrotate group="2"]

Multiple groups and a random advert from either group:

[adrotate group="4,12,5,2"]

Group with optional fallback override (Group 7, fall back on group 19):

[adrotate group="7" fallback="19"]

Group with optional weight override (Group 23, show only adverts with weight 4 or higher):

[adrotate group="23" weight="4"]

Cross site ads on a Multisite with a Developer License:

[adrotate group="7" site="yes"]
[adrotate banner="12" site="yes"]

Using PHP code

Caution: For advanced users only!

Insert the following PHP code in index.php, page.php or single.php of your theme. Or anywhere where you want the banner to show, as many as you like.
If you have custom templates or you now what you are doing you can insert the code in other files as well.

Examples:

Single advert:

echo adrotate_ad('1');

A random advert from a group:

echo adrotate_group('12');

Multiple groups and a random banner from either group:

echo adrotate_group('3,2,6');

Fallback override for a group (group 4, falls back on group 16):

echo adrotate_group('4', array('fallback' => '16'));

Weight override for a group (group 12, showing adverts with weight 8 or higher):

echo adrotate_group('12', array('weight' => '8'));

Cross site ads on a Multisite with a Developer License:

echo adrotate_group('4', array('site' => 'yes'));
echo adrotate_ad('4', array('site' => 'yes', 'wrapper' => 'no'));

Back to AdRotate Manuals

You may be interested in