Advanced Ads provides shortcodes for each ad, group, and placement to be added into the content of pages manually.
Table of Contents
Shortcode for ads
You can find the shortcode for an individual ad below the ad’s title on the edit page.
The shortcode for single ads looks like below, with 648 being the individual ad ID.
Showing all shortcodes in the ad list
If you want to show all shortcodes in the ad list in the backend:
- Go to Advanced Ads > Ads
- Open the Screen Options at the top right of the screen
- Enable Ad Shortcode in the Columns options
Shortcode for groups
You can find the shortcode for a group when you click on Usage below the group title on the group list.
The shortcode for a single group looks like below, with
5 being the ID of the group.
Shortcode for placements
Only the Manual placements have shortcodes. You can find the shortcode when you click on show usage below the placement title.
The shortcode for a single placement does contain the name instead of a number as an ID. In the below example, it is custom-placement.
Overriding attributes in shortcodes
You can override most options in a shortcode. You can also override attributes of ads via the group shortcode or a placement.
The logic uses the prefix change-ad, change-group, or change-placement and double underscores to separate options in arrays.
To find the correct option to change, take a look at the source code. This is why this feature is only meant for advanced developers.
There are some options that you can’t adjust:
- cache-busting settings
- target URL with click tracking
How to change the content of an ad and the top margin.
[the_ad id="123" change-ad__content="ad content" change-ad__output__margin__top="5"]
Adjusting how many ads are displayed simultaneously for a group and the top margin of the ads showing up.
[the_ad_group id="14" change-group__ad_count="2" change-ad__output__margin__top="5"]
Changing the element displayed through a placement and the content of the displayed ad.
[the_ad_placement id="bc" change-placement__item="ad_211" change-ad__content="ad content"]
Using shortcodes from another blog in a multisite
With Advanced Ads Pro, you can also use the blog_id attribute on multisites to load an ad from another blog in the network.
The shortcode loads the ad with the ID 123 from blog 1 and can be used on every other blog in the multisite network where Advanced Ads and Advanced Ads Pro are activated.
[the_ad id="123" blog_id="1"]
Shortcode is visible in the frontend
Shortcodes are a WordPress standard. However, it is up to each plugin and theme to interpret them in their options. E.g., a theme might come with an option to add code to a certain position on the page, but not interpret shortcodes entered in it.
If you notice that only the shortcode string appears, but not the respective ad, group, or placement in its place, the missing shortcode support is probably the cause. In this case, the Custom Position placement is a good alternative.
Alternatively, you can contact your theme’s support and ask them to enable shortcodes for their options.