Help Center > Manage Your Account > Serving Code

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 AdSpeed's serving code in the content area. Click Save.

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 would need to use is_category(). 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 (programming interface) to develop an automated solution.
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 would need to 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 Serving Code

Understand advanced ad serving settings for standard, pop-up/pop-under, and interstitial serving code
Search Help Center
There was a problem with your submission. Please correct the following items:

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

    Related Articles

    Have questions? Contact Us

    Testimonials for our Ad Servers

    • I have to say I am very impressed with the new version of your site. Great work!

      Chinedu E
      HopStop

    • I've signed up for the trial run but am confident that I'll continue. Great service!

      Wade W
      Cycling Tips Blog