Show an ad with a shortcode or block
Use these when you want an ad in one exact spot instead of an automatic placement.
Shortcodes
Paste a shortcode into a post, a page, a text widget, or the shortcode block of any page builder such as Elementor or Divi.
| Shortcode | What it shows |
|---|---|
[amkit_ad id="123"] |
One ad. The ID is on the ad’s edit screen, in the Shortcode box. |
[amkit_ad_group id="4"] |
A group of ads, rotated as the group is set up. Use slug="summer-sale" instead of id if you prefer. |
[amkit_ad_placement id="sidebar-top"] |
A placement, with whatever ad or group is assigned to it. |
An ad’s edit screen shows its own shortcode with a Copy button. The Groups screen shows each group’s shortcode, and the Placements screen shows the shortcode of each manual placement under its name.
The block editor
In the post editor, add the Sanil Ads Kit block. In its Ad Settings, set Display type to Single Ad or Ad Group, then choose the ad or group. The block does not take a placement.
Theme templates
In a theme file, call a function. It accepts a group’s ID or slug and a placement’s ID.
<?php amkit_ad_placement( 'sidebar-top' ); ?>
<?php amkit_ad_group( 'summer-sale' ); ?>
You can also use an action, which is handy in code that should not break if the plugin is switched off:
<?php do_action( 'amkit_ads_placement', 'sidebar-top' ); ?>
A shortcode only shows an ad that is published and passes its schedule, targeting and device settings. If nothing appears, work through My ad is not showing.