Advanced Ads provides shortcodes for each ad, group, and placement to be added into the content of pages manually.
Shortcode for ads
You can find the shortcode for an individual ad below the title of the ad 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. In order 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.
Some options can’t be adjusted:
- cache-busting settings
- target url with click tracking
Changing the content of an ad and the top margin.
[the_ad id="123" change-ad__content="ad content" change-ad__output__margin__top="5"]
Changing how many ads are displayed at the same time 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"]