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 types of pages: blog pages (homepage, category pages, search pages, tag pages) and single pages (posts and static pages). You can enable insertion for each page type. There are also other, special 'page types': page for error 404 (Page not found), AMP pages, RSS feed and Ajax requests.
Single pages are posts and static pages. They show one article or page. Ad Inserter labels:
- Static Pages
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 lists to filter urls, IDs, categories or tags you should use default blank selection for posts or pages as these settings affect only individual exceptions on post/static page editor pages.
Blog pages are pages that show few latest posts with excerpts (or full posts). 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 automatic insertion will not be possible as on typical blog pages. Ad Inserter labels:
- Category pages
- Search Pages
- Archive pages
Positions for automatic insertion
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). Some themes use content hooks also on blog pages. In such cases you can also use content positions on blog pages. Use debugging functions to show available positions.
Available only on single pages:
- Before/after paragraph
- Before/after content
- Before/between/after comments
Available only on blog pages:
- Before/after excerpt (only if WP excerpts are used)
- Between posts
Available on all page types (but not all themes use them):
- Before/after post
PLEASE NOTE: 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 absolutely sure this is what you need and it works fine with your theme. Only position Before/After Post is normally available on all page types.
Insertion (located in the Misc section) is possible also for:
- AMP pages
- Ajax requests (e.g. for endless scroll)
- Error 404 page (Error 404: Page not found)
- RSS Feed
Shortcodes and PHP function calls
For shortcodes and PHP function calls it is possible to ignore enabled page types and use them on any page.
- Shortcode - Insert shortcode
[adinserter name="BLOCK_NAME"]into post or page HTML code to insert block with BLOCK_NAME name or BLOCK_NUMBER number at this position. PLEASE NOTE: Shortcodes IGNORE post/static page exception settings! You can also insert shortcode that ignores enabled page types with
[adinserter block="BLOCK_NUMBER" ignore="page_type"]
- PHP function call
<?php if (function_exists ('adinserter')) echo adinserter (BLOCK_NUMBER); ?>- Insert code block BLOCK_NUMBER at any position in template file. You can also define Filter (section Misc) for PHP function - define which call(s) to the function will actually insert code. This is useful if you put a call to the
adinserterfunction 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
<?php if (function_exists ('adinserter')) echo adinserter (BLOCK_NUMBER, 'page_type'); ?>