The Display Conditions are one of the most powerful, but complex features in Advanced Ads. They allow you to define the attributes of pages on which the ad should show up or hide in very fine detail.
If you use Advanced Ads Pro, these conditions not only give you more control over ads but also allow you to use this feature for placements too.
Please note that Display Conditions are not injecting ads (this is what Placements are for). They only limit already injected ads to specific pages.
Table of Contents
List of available Display Conditions
The available Display Conditions are dynamic. New conditions are added for each public taxonomy (Categories and Tags by default).
Accelerated Mobile Pages (AMP) | The AMP condition allows you to display ads on Accelerated Mobile Pages. See Display Ads on AMP pages. |
Archive: {taxonomy} | While {taxonomy} is a placeholder for any taxonomy (Categories and Tags by default), this option can limit ads to specific archive pages. Archive pages are lists of posts or other post types belonging to a specific taxonomy. Every taxonomy has its own display condition set. The defaults are Categories and Tags. With more than 50 terms per taxonomy, there is a search field instead of a list with all terms. |
Author | The Authors Condition allows you to limit ads to posts from specific authors. |
BuddyBoss Group | This condition automatically detects the existing BuddyBoss groups and allows targeting ads according to them. Manual – Advanced Ads Pro |
Content Age | The Age condition allows you to display ads based on the age of the content, e.g. “older than 5 days”. Manual |
Feed | The Feed condition allows you to display ads in your site’s RSS feed. See Ads in RSS Feeds. |
Format, Archive: Format | Post Formats are a feature in some themes allowing you to customize the output of a post. |
General Conditions | The General Conditions are a set of most important page types and active by default. Find remarks on Secondary Queries below. |
Pagination | Display ads only on specific pages in a paginated post. Advanced Ads Pro |
Paid Memberships Pro | Display or hide ads based on the defined membership level of content pages. |
Parent Page | Display an ad based on the parent page for hierarchical post types (including pages). Advanced Ads Pro |
Post Content | Display an ad based on specific keywords or phrases in the content. |
Post Meta | The post meta condition allows you to target a meta value attached to a post or page. This is also the correct condition when targeting ads by custom field. |
Post Type | Choose the public post type of content where the ad can be displayed. This condition works on single pages as well as archive pages. |
Post Type / Page Template | Display ads based on the post type template (since WordPress 4.7). |
Specific Pages | Display or hide an ad from specific published posts or pages. Start typing the page’s title to see suggestions or search for the post/page ID. |
Taxonomy | While the Archive: {taxonomy} condition can be used for individual terms from a given taxonomy, the Taxonomy condition is meant to limit ads to archive pages for all terms belonging to a taxonomy. |
{taxonomy}, Categories, Tags | While {taxonomy} is a placeholder for any taxonomy (Categories and Tags by default), this option can limit ads to posts that belong to these specific terms. Every taxonomy has its own display condition set. The defaults are Categories and Tags. |
URL Parameters | Display ads based on URL parameters. This is useful if you have specific parameters in your URL or want to create additional display conditions. Manual – Advanced Ads Pro |
WPML language | Display ads based on the page language set by the WPML plugin. Manual – Advanced Ads Pro |
Video
In this video, I am explaining how to use the Display Conditions. The manual below might cover these topics in more detail, but I think it is a good starting point.
How to use Display Conditions
You can set Display Conditions in the Display Conditions meta box on the ad edit screen. If you want to display the ad everywhere, you don’t need to set any display conditions. Some conditions allow you to select whether you want to show or hide ads only on pages with the selected feature.
You can
- add more conditions by adding them through the New condition option. (see the list of display conditions below).
- remove conditions by clicking on the (x) button behind the line. The fewer conditions you use, the better for your site’s performance.
Blue elements are activated, while grey elements are disabled.
Choices within a condition set are combined via OR. For example, when you select multiple categories for a post with an ad, the post only needs to belong to one of these categories for the ad to appear.
Combining conditions with AND and OR
This is what you need to know when combining conditions:
- conditions are checked in the order they are set
- the OR operator means that the next condition is checked, even if the previous one was false
- you can understand conditions combined by OR as blocks where only one of the conditions needs to be true to show an ad
- the AND operator means that the whole check is stopped and returns false when any of the conditions connected with AND is false
By default, different conditions are combined via OR. This means that only one of the set conditions needs to match to show the ad.
The following example combines two Categories conditions. It displays the ad in posts with the “Best Articles” category but prevents it from appearing in posts that are also in the “News” category.
You can also change the connector from OR to AND by just clicking on it. An OR connector in front of a condition simply means that the previous condition can be false, but the whole conditions return true if the OR combined check is true.
Display Conditions Examples
Here are some showcases for Display Conditions. Understanding the examples will help you get the most out of your conditions. The examples for categories work exactly the same for tags and custom taxonomies.
Debugging Display Conditions
There are various reasons why Display Conditions could not work, here are some:
- a custom query was not used properly
- the conditions are wrongly connected (e.g., AND used instead of OR)
- the content is requested via ajax
- the content is requested in an iframe
Neither of the problems above is caused by Advanced Ads, but there is a way Advanced Ads can help you to solve them. Switch the ad to debug mode for more information.
What else you need to know
Practically, you don’t need to set display conditions if you use the ad in a place where it should always appear. The more specific the place, e.g. using the the_ad()
function within a specific template file like single.php
the less careful you probably need to define the display conditions.
Secondary Queries
Secondary Queries in WordPress could be a list of posts that don’t belong to the post type but are added in addition. E.g., on a single post, the main post would be the primary query, but a list of related posts in the sidebar or post teasers below the main article could be a secondary query.
With ad injections, it can happen that teasers from secondary queried posts also contain ads. To prevent this from happening, you can disable ads on Secondary Queries on a per-ad basis or globally in the plugin settings.