Shortcodes

By  Stephan Depta
Last updated September 15, 2026

AdPresso provides shortcodes for rendering individual ads, ad groups and manual placements anywhere WordPress processes shortcodes.

All AdPresso shortcodes use the regular AdPresso rendering pipeline. Conditions, frontend rendering, group selection, and other AdPresso functionality, therefore, continue to apply when an item is inserted using a shortcode.

Available shortcodes

AdPresso provides three native shortcodes:

ShortcodeDescription
Render an individual ad
Render an ad group
Render a manual placement

The id attribute refers to the WordPress post ID of the respective AdPresso entity.


Render an ad

Use adpresso_ad to render an individual AdPresso ad directly.

[adpresso_ad id="123"]

Replace 123 with the ID of the ad you want to display.

AdPresso creates a virtual placement for the ad and passes it through the regular rendering pipeline. This means that conditions and frontend-dependent logic assigned to the ad are still evaluated.

Example

[adpresso_ad id="123" align="center"]

This renders the ad 123 and centers its placement wrapper.


Render an ad group

Use adpresso_group to render an AdPresso group.

[adpresso_group id="456"]

The group keeps its configured behavior when rendered through a shortcode, including its ad selection and display settings.

Example

[adpresso_group id="456" class="sidebar-ads"]

This renders the group 456 and adds the CSS class sidebar-ads to the generated placement wrapper.


Render a manual placement

Use adpresso_placement to render a Manual Placement.

[adpresso_placement id="789"]

Manual Placements are useful when you want to configure the ad or group, conditions and other placement settings inside AdPresso, but decide the exact output location yourself.

The ID refers to the Placement ID, not the ID of the ad or group assigned to it.

Example

[adpresso_placement id="789"]

AdPresso loads the configured item and settings of placement 789 and renders it at the location of the shortcode.

Although the rendering engine can technically process other placement types through this shortcode, adpresso_placement is intended for Manual Placements.


Shortcode attributes

The following attributes can be used with AdPresso shortcodes.

id

Required

Defines the ID of the ad, group or placement to render.

[adpresso_ad id="123"]

If the ID is missing, invalid or no longer resolves to an AdPresso entity, the shortcode returns no output.


class

Adds one or more custom CSS classes to the placement wrapper.

[adpresso_ad id="123" class="my-custom-ad"]

Multiple classes can also be passed:

[adpresso_group id="456" class="sidebar-ads highlighted-ad"]

The classes are added in addition to AdPresso's regular frontend classes.

This can be useful for custom styling or JavaScript integrations.


margin

Overrides the margin of the shortcode placement.

The value accepts CSS margin shorthand syntax.

[adpresso_ad id="123" margin="20px"]

Different horizontal and vertical margins:

[adpresso_ad id="123" margin="20px 0"]

Four individual values:

[adpresso_group id="456" margin="10px 20px 30px 20px"]

The shortcode override is applied to the generated placement wrapper.


align

Overrides the alignment of the shortcode output.

Supported values are:

  • left
  • center
  • right

Center an ad:

[adpresso_ad id="123" align="center"]

Float an ad to the left:

[adpresso_ad id="123" align="left"]

Float an ad to the right:

[adpresso_ad id="123" align="right"]

left and right use CSS floats, allowing surrounding content to flow around the placement. center renders the wrapper as a block with automatic left and right margins.


inline

Render the placement using an inline wrapper.

[adpresso_ad id="123" inline="true"]

By default, wrapped shortcode output uses a <div> element. When inline is enabled, AdPresso uses a <span> wrapper instead.

Inline output also suppresses the AdPresso ad label for that placement.

To disable inline rendering, omit the attribute entirely.

[adpresso_ad id="123"]

Combining attributes

Attributes can be combined.

[adpresso_ad id="123" align="center" margin="20px 0" class="featured-ad"]

Or for an inline ad:

[adpresso_ad id="123" inline="true" class="inline-sponsored-link"]

Runtime shortcode attributes affect only this occurrence of the ad, group or placement. They do not modify the saved entity settings inside AdPresso.


Using AdPresso shortcodes in PHP

WordPress shortcodes can also be processed inside PHP templates using do_shortcode():

echo do_shortcode( '[adpresso_ad id="123"]' );

For a group:

echo do_shortcode( '[adpresso_group id="456"]' );

For a manual placement:

echo do_shortcode( '[adpresso_placement id="789"]' );

AdPresso also provides the adpresso_the_placement() PHP helper for directly rendering a placement from theme or plugin code:

adpresso_the_placement( 789 );

To receive the rendered HTML instead of printing it directly:

$output = adpresso_the_placement( 789, true );

Advanced Ads shortcode compatibility

AdPresso can retain existing Advanced Ads shortcodes after migrating content from Advanced Ads.

The following legacy shortcodes are supported:

[the_ad id="123"]
[the_ad_group id="123"]
[the_ad_placement id="placement-slug"]

These shortcodes are compatibility aliases intended for migrated Advanced Ads installations. AdPresso maps the original Advanced Ads IDs or placement identifiers to their imported AdPresso entities.

AdPresso registers the legacy shortcodes only when the Advanced Ads shortcode is not already registered by another plugin.

For new implementations, use the native AdPresso shortcodes instead:

[adpresso_ad]
[adpresso_group]
[adpresso_placement]

More developer resources

Continue exploring the AdPresso developer documentation:

This is AdPresso

Streamlined WordPress ad management, built on 15 years of expertise for serious monetization.
Features robust protection, targeting, A/B testing, diverse placements, and insightful tracking to spark your full revenue potential.

BlogStudies
AdPresso Logo