Skip to main content
All CollectionsAd Units and Code Snippets
Installing Adsterra Ads to WordPress
Installing Adsterra Ads to WordPress

Learn how to install Adsterra's advertising codes on your Wordpress blogs and sites

Ana M avatar
Written by Ana M
Updated over a year ago

💡 WordPress allows you to add our codes to all pages at once, a specific page or even into any one post. We'll be using WordPress 5.7.1 in this guide, so please be mindful that there may be minor differences if your version is different. You can always look up adding custom HTML in your WordPress documentation.

Adding Ads to Every Page

Installing our ads to every page of your WordPress website usually requires editing the theme. There are two ways to do that:

Editing the Source Code

It works best for Social Bar and Popunder codes, however you can add almost any Ad Unit. To access the theme:

  1. Click 'Appearance' and select 'Theme Editor' from the left-hand menu;

  2. Find the theme element you'd like to add the code snippet to under the 'Theme Files' on the right;

  3. Click the element name (for example, Theme Header or Theme Footer) to see its source code;

  4. Where you paste the code snippet depends on the Ad Unit:

    • To add a Popunder, paste the code snippet right before the closing </head> tag (usually available in the 'Theme Header' file);

    • Place Social Bar code at the very end of the file;

    • Banners and Native Banners can be placed anywhere in the page body, but make sure it fits in well.

  5. Click 'Update file' below to save the changes.

Placing the Code Snippet via Widgets

Widgets are more convenient when working with Native Banners and Banners, as they are a bit more visual. 'Custom HTML' is the only widget you'll need to install any Adsterra Ad Unit, however you can also use 'Text' widget if your WordPress version is below 4.8.1 and does not support 'Custom HTML'

  1. Click 'Appearance' and select 'Widgets';

  2. Select on the 'Custom HTML' widget;

  3. Check the theme element and click 'Add Widget'; the widget will open in the element section;

  4. Paste the code snippet into the widget and click 'Save'.

Bear in mind that you may need to double-check if the code snippets you added are still available whenever you switch your WordPress theme.

Placing an Ad on a Single Page

If you want to have an ad on a specific page only, you can add the 'Custom HTML' widget to this page only. This will work for any Ad Unit as well.

  1. Select 'Pages' from the left-hand menu;

  2. Mouse over the page you'd like to modify and select 'Edit';

  3. Click ➕ and select 'Custom HTML'

  4. Insert the code snippet into the text box;

  5. Click 'Update' in the upper right corner.

Having added the code, you can click 'Preview' to check if the ad has been installed correctly.

Adding an Ad to a Post

Native Banners and horizontal Banners would look the best within a post, right after the title or between two paragraphs. We'll use the 'Custom HTML' widget for this as well.

  1. Navigate to 'Posts' from the left-hand menu;

  2. Find your post in the list, hover over its title and select 'Edit';

  3. Click ➕ in the upper left corner and scroll down to Widgets

  4. Paste the script from the Websites page into the widget;

  5. Click 'Update' in the upper right corner.

When adding the ads, make sure your scripts don't conflict: if you have a Social Bar or Popunder in your theme, adding the same ad unit to a specific page or post may prevent both codes from working.

💡 Note that we do not provide ads.txt files, as our advertisers do not require them.

If you still need it, you can contact us to request the required details and create the file on your own. We'll be glad to share the needed data with you!

Did this answer your question?