WordPress Page Types
For each Ad Inserter code block you need to enable at least one WordPress page type where the code block can be inserted (and ads displayed).
At least one page type needs to be enabled regardless of other settings or insertion positions.
WordPress has basically two groups of pages types: single pages (posts and static pages) and blog pages (homepage, category pages, search pages, tag pages). You can enable insertion for each page type.
There are also other, special page types which can be enabled (button Misc / tab Insertion): AMP pages, Ajax requests, RSS feed and page for error 404 (Page not found).
Single pages are posts and static pages. They show one article or page. Ad Inserter labels for single pages:
- Static pages
Posts are entries listed in reverse chronological order on the blog page. Pages are static and are not listed by date. Pages do not use tags or categories. An About page is a typical example of static page.
Single pages have also additional setting for individual exceptions. If you are not using individual post/page exceptions (on post/page editor pages) then use default BLANK selection. Even if you use white/black lists to filter categories, tags, urls, post IDs, countries, you should use default blank selection for posts and pages as these settings affect only individual exceptions on post/ page editor pages.
Blog pages are pages that show few latest posts with excerpts (or full posts) in reverse chronological order. Such blog pages are category pages, tag pages, archive pages and also homepage if set to show latest posts. If your theme has custom homepage or the homepage is set as static page then homepage is not blog page and typical positions for automatic insertion on blog pages will not be available. However, you can still use other insertions for such homepage. Use also debugging function Show positions to see available positions for automatic insertion. Ad Inserter labels for blog pages:
- Category pages
- Search pages
- Tag / Archive pages
Because each page type has different page layout, all positions for automatic insertion are not available on all page types. The word content used in the context of automatic insertion means the content of post or static page (paragraphs that make the post or static page).
Available mainly on single pages:
- Before/after paragraph
- Before/after content
- Before/between/after comments
Available only on blog pages:
- Before/after excerpt (only if standard WordPress excerpts are used)
- Between posts (only if standard WordPress full posts or excerpts are used)
Available on all page types (but not all themes use them):
- Before/after post
These positions use
loop_end hooks which may also be used at other positions where WP loops are used (for example inside a slider).
Available on all page types (almost all themes use them):
- Above header (below
<body>tag, available only when you enable Output buffering)
- Footer (above
In most cases you should enable each code block ONLY either on single pages or on blog pages. DO NOT enable both unless you are using widgets or you absolutely sure this is what you need and it works fine with your theme. Only widgets and position Before/After Post are normally available on all page types.
For widgets you usually need to enable all page types as you probably want to display widgets on all pages.
Insertion position Above header inserts code after
<body> tag, while Header code in general plugin setting (tab ⚙) inserts the code (scripts) in the
<head> section of the HTML page.
Some themes use content hook (
the_content) also on blog pages. In such cases you can also use content positions on blog pages. Use debugging function Show positions to show available positions for automatic insertion.
Insertion (button Misc / tab Insertion) is possible also for:
- AMP pages (this option insert THE SAME code also on AMP pages)
- Ajax requests (e.g. for endless scroll)
- Error 404 page (Error 404: Page not found)
- RSS Feed
For shortcodes and PHP function calls it is possible to ignore enabled page types and use them on any page.
- Shortcode – add
ignore="page-type"to the shortcode (for example,
[adinserter block="1" ignore="page-type"]).
- PHP function call – add second parameter
'page-type', for example
<?php if (function_exists ('adinserter')) echo adinserter (1, 'page-type'); ?>