Press enter to see results or esc to cancel.

Manual Insertion

The button Manual below the code editor opens settings for manual insertion.

ad inserter buttons

Manual insertion means inserting ads or codes by manually placing shortcode at some particular position in post or static page, manually placing widget into a widget position (or sidebar) or modifying theme PHP file to add Ad Inserter PHP function call in order to insert ad code at this position. Once you place shortcode, widget or PHP function call the insertion is still automatic on all posts and pages according to the settings.

ad inserter manual insertion

Widgets

WordPress Widgets add content and features to the Sidebars – widget positions supported by the theme. Examples are the default widgets that come with WordPress: for Categories, Tag cloud, Search, etc. Ad Inserter adds own widget for code blocks.

Ad Inserter widgets are enabled by default – simply drag Ad Inserter widget to any widget (or sidebar) position, select Ad Inserter code block, save widget and you’re done.

Optionally you can enable Sticky widget – this means that this widget (and widgets below) will stay fixed in the sidebar when the page is scrolled, but please note that this may not work with all themes.

There are two modes for sticky widgets (or sticky sidebars) available as Sticky widget mode in general plugin settings (tab / tab General):

  • CSS mode
    This mode is the best approach but may not work with all themes. CSS mode works by changing sidebar CSS to position: sticky. This works in most themes but not all. If your widgets and sidebar aren’t sticking as expected you can use JavaScript mode described below. If you would like to try to make CSS mode working the first thing to check are the rules applied to the sidebar parent containers. Specifically, look for any overflow property set on the parent. You can’t use: overflow: hidden, overflow: scroll or overflow: auto on the parent of a position: sticky sidebar. If your theme is not using overflow and still having problems it’s worth checking if a height is set on the parent. This may constrain the sticky positioning, stopping it from occurring. Remove the height and see if that fixes the problem.
  • JavaScript mode
    This mode should work with practically all themes but may reload ads on page load when sticky sidebar is initialized. Use only when CSS mode does not work

You can also make other widgets sticky even if you don’t use Ad Inserter widgets – drag Ad Inserter widget to the sidebar ABOVE the top widget that needs to be sticky, select Dummy Widget for Block, check Sticky and save widget. Use only one sticky widget in each sidebar!

In plugin settings (tab / tab General) you can also define Sticky widget top margin to precisely define top position where the first sticky widget will stop.

Once a widget is placed into a widget position (or sidebar) the name of this widget position is listed next to the Widget checkbox for the selected block.

Shortcodes

A shortcode is a WordPress-specific code that lets you do nifty things with very little effort.

Insert shortcode [adinserter block="BLOCK_NUMBER"] or [adinserter name="BLOCK_NAME"] into post or page to insert block with name BLOCK_NAME or number BLOCK_NUMBER at some position.

Shortcodes normally insert block code wrapped with the wrapping div with alignment code. To insert only pure block code use shortcode [adinserter code="BLOCK_NUMBER"].

Shortcodes IGNORE individual post/page exceptions! To force checking individual post/page exceptions add check="exceptions" to the shortcode (for example, [adinserter block="BLOCK_NUMBER" check="exceptions"]).

You can also insert a shortcode that ignores enabled page types by adding ignore="page-type" to the shortcode (for example, [adinserter block="BLOCK_NUMBER" ignore="page-type"]).

The following shortcodes are available to insert various post/page/visitor data:

  • [adinserter data='title'] – The title of the post
  • [adinserter data='short-title'] – Short title (first 3 words) of the post title
  • [adinserter data='category'] – Category of the post (or short title if there is no category)
  • [adinserter data='short-category'] – First words before “,” or “and” of the category of the post (or short title if there is no category)
  • [adinserter data='tag'] – The first tag or general tag if the post has no tags (works only inside posts)
  • [adinserter data='smart-tag'] – Smart selection of post tag in the following order:
    • If there is no tag then the category is used;
    • If there is a two-word tag then it is used;
    • If the first tag is a substring of the second (or vice versa) then the first tag is not taken into account
    • If the first and second tags are single words then both words are used
    • First three words of the first tag
    • General tag
  • [adinserter data='search-query'] – Search engine query that brought visitor to your website (supports Google, Yahoo, Bing and Ask search engines), {smart_tag} is used when there is no search query. You need to disable caching to use this tag. Please note that most search queries are now encrypted and therefore not available.
  • PRO [adinserter data='country-iso2'] – lowercase country ISO Alpha-2 code (based on visitor’s IP address, works only when server-side Dynamic blocks are used), use  [adinserter data='country-ISO2'] for uppercase code.
  • PRO [adinserter data='ip-address'] – IP address (works only when server-side Dynamic blocks are used)
  • PRO [adinserter data='author'] – post author username (works only inside posts)
  • PRO [adinserter data='author-name'] – post author name (works only inside posts)
  • PRO [adinserter custom-field='CUSTOM_FIELD_NAME'] – custom fields as defined in posts
  • shortcodes for ad blocking detection functions

Shortcodes are also used as code separators for ad counting, ad rotation and separation of AMP code. The order of processing separator shortcodes is the following:

  1. [ADINSERTER COUNT]
  2. [ADINSERTER ROTATE]
  3. [ADINSERTER AMP]

This means that you can have AMP separator inside ROTATE options and they can be used as COUNT options.

Ad Inserter supports also shortcodes from other plugins. Simply use them in code blocks.Before code block will be inserted Ad Inserter will call WordPress function do_shortcode () to expand shortcodes from other plugins you may used in block code.

Shortcodes Not Working

Ad Inserter supports shortcodes, however, there are many possible reasons why shortcodes are not working. Please carefully check possible reasons listed below. When you place a shortcode somewhere, the theme (or WordPress in some cases) MUST PROCESS those shortcodes, i.e. call WordPress function do_shortcode () in order to call plugins for each type of shortcode. If the theme does not process shortcodes then plugins including Ad Inserter will not be called and will not be able to expand shortcodes.

Possible symptoms:

  1. Ad Inserter shortcodes like [adinserter block="N"] are not expanded into block code, you see unprocessed shortcode [adinserter block="N"]. Possible reasons:
    • Ad Inserter plugin is not activated.
    • The theme (or WordPress) does not process shortcodes where you have used them.
  2. Ad Inserter shortcodes like [adinserter block="N"] are empty.
    • Shortcode for block N is not enabled. Make sure shortcodes are enabled for this block (button Manual).
    • Shortcode inserts block code, but the code doesn’t display anything. Use debugging function Label blocks to check if this is the case.
  3. Shortcodes from other plugins used in Ad Inserter blocks are not not expanded, you see unprocessed shortcode. 
    • Plugin that should process your shortcodes is not activated.

If Ad Inserter is not activated then it can’t process [adinserter] and [ADINSERTER] shortcodes.

By default, WordPress does not support shortcodes within Sidebar Widgets until 4.9. It only expands the shortcodes within the content of a Post, Page, or custom post type. To add shortcode support to sidebar widgets, you can install a plugin.

In the case your theme does not process shortcodes where you would need them you can still use other insertions, for example, insertion before or after HTML element to insert code there.

PHP function call

With PHP function call <?php if (function_exists ('adinserter')) echo adinserter (BLOCK_NUMBER); ?> you can insert code block BLOCK_NUMBER at any position in any template file. You can also define Filter for PHP function – which call(s) to the function will actually insert code. This is useful if you put a call to the adinserter function inside a loop in a template file (e.g. for homepage) and you need to insert ads only few times between posts.

You can also use PHP function calls that ignore enabled page types with second parameter 'page-type', for example <?php if (function_exists ('adinserter')) echo adinserter (BLOCK_NUMBER, 'page-type'); ?>

Alternative to PHP function adinserter() is custom hook using do_action () WordPress function. This provides more flexibility as you can use custom hook positions for automatic insertion.

Quickly disable insertion

To insert code block you need to use automatic or manual insertion. Once you configure the settings including insertion, the code will be inserted. If for some reason you need to temporarily disable (pause) insertion you can disable automatic insertion or uncheck manual insertion.

To achieve the same effect without changing the settings you can simply disable (pause) insertion of each code block. To disable insertion of code block click on the pause button (it will be red when paused) and save settings.

ad inserter disable insertion