To display an ad on your website you can use one of these methods.

  • auto inject them (as explained here)
  • function in your template
  • shortcode in your post content
  • through the ad widget
  • through placements

On this page you learn how to use the function and the shortcode to display a specific ad. You can also display an ad through ad groups or placements. Visit the appropriate sections in the manual to learn more about those methods.

Usage

Before using either of the next two methods you need to find the ID of the ad. Just visit the edit page of the ad. You can find the ID either below the ad title or after the post-parameter in the url.

Function

Use the following code to insert the ad with the ID 24 into your theme:

Just open the template file and include the code. The first part will guarantee that there will be no error message in case you deactivate the plugin and forgot to remove the code snippet before.

You can learn more about theme functions in the manual.

Shortcode

The shortcode is the easiest method to insert an ad anywhere within a static page or a post. For our ad with the ID 24 just use this shortcode.

Just open the post, page or any other post type with a content field and include the code.

You can learn more about shortcodes in the manual.

What else you need to know

When using either of these methods the ad will not be displayed in case any condition you set for it prevents the output. To get the content of an ad for your own purposes and without the condition check use $ad = new Advanced_Ads_Ad( (int) $ad_id, $args = array() ) .

 Publishing Ads  
Total 14 Votes:
2

Tell us how can we improve this information?

+ = Verify Human or Spambot ?