Help Center Manage Your Account Ad Tag

How do I set up advertising on WordPress?

WordPress is a popular publishing platform with many advanced customizations to suit your own preferences. To place ads into your WordPress blog/CMS, you can use AdSpeed plugin for WordPress. For more advanced ad setup, you would need to place the serving code directly into the WordPress templates.

Display ads on the sidebar

You can install AdSpeed plugin for WordPress to display ads on the sidebar. However, if you cannot install plugin for your WordPress installation or need custom parameters, you can use the WordPress built-in Text widget:
  • Open Dashboard. Choose Appearance > Widgets.
  • Drag the 'Text' widget from the Available Widgets to the Sidebar section.
  • Open the 'Text' widget in the Sidebar. Paste the zone's ad tag into the content area. Click Save. To get the zone's ad tag, you need to sign into your AdSpeed account, click on the zone name and click on tab "Ad Tag".

Display ads only on the homepage

You would use the condition tag is_home() in the homepage.php (or index.php). For default theme, the file would be in this folder htdocs/wp/wp-content/themes/default/
<?php if(is_home()) { ?>
  SERVING CODE
<?php } ?>

Display different ads for each content category

Our system is very flexible in the way you sell and organize ads. In WordPress, you can use the Display Widgets Plugin or you can use WordPress API is_category() directly. These are several methods to organize the ads:
1. One zone per category
You can create multiple zones, one for each category and get the serving code for the zone to put into the WordPress template. Any/all ads linked to this zone will get served in the category. This is the easiest solution to setup and manage. However, if you have many many categories then setting up the first time might take some time. To address this labor-intensive operation, you can use our API (application programming interface) to create the zones in batch.
2. URL targeting
You can create a few zones based on ad location (eg: top, right, bottom) that are shared across categories. The ads linked to these zones then have URL targeting. For example: only display AdA when the URL has "CategoryABC"). This requires that the URL follows a pattern that contains the defined category.

Display category ads on an article/post

If a post is placed in one or more categories, you might want to display ads only for these categories. You can use the Display Widgets Plugin or edit the single.php template file and use the function in_category() to check if the post is linked to certain categories.
<?php if (in_category('Travel')) { ?>
  [Serving Code for Category/Zone Travel]
<?php } ?>

Other Articles in Ad Tag

This section describes the ad tag (serving code) with basic and advanced settings. It includes common ad serving setup instructions and answers frequently asked questions when integrating the ad tag into your site, blog or app.

Cannot find an answer for your question? Ask our Customer Care team

Related