Increase available ad weight in groups

By default, Advanced Ads sets the available ad weight for ads in groups to 10. This number increases if the amount of ads in the group is higher. You can also add your own ad weight maximum using the code below. /** * Increase available ad weight in group settings * uses 100 if regular […]

Add a taxonomy for ads

By default, Advanced Ads comes with “Ad Groups” as the only taxonomy. If you need further options to group ads then you can build that using the code below as a basis. I built that as a custom job for a client to allow grouping ads by a “company” taxonomy. Since it is a bit […]

Change div container to another HTML element

Some users might want to change the div container Advanced Ads uses for ad placeholders in Advanced Ads Pro cache-busting or when some output options like a margin are selected. The code below changes the div into an article container. Please notice that this could break some other part in Advanced Ads, especially JavaScript-based ad placements. […]

Adding your own placement

You can add your own placement to Advanced Ads. The example below does that for a specific action hook. You can adjust it according to your own purpose. Just change the ADVADS_CUSTOM_HOOK_PLACEMENT_HOOK_NAME to any action hook you want to show the ads in. The whole code from below can go into a new PHP file which […]

Using the advads JavaScript library after jQuery is available

If you are using our advanced JavaScript functions to retrieve or store cookies on a website that loads the jQuery library in the footer, you might be interested in the following code snippets. The first part is an example of how to show the number of page impressions from the appropriate cookie. The second snippet shows […]

Allow custom meta boxes on ad edit screen

Advanced Ads removes custom meta boxes on the ad edit screen. This is needed, because sometimes, plugin authors forgot to specify that their particular meta box is only meant for publish post types, like posts and pages. Users then might have seen an SEO-related box on the ad pages, which neither worked nor made sense. […]

Block specific user agents and referrers from being tracked

The following code allows you to block specific user agents or referrers from being tracked with the Tracking add-on. It was written for a very specific use case in mind but can still serve you as a basis to implement your own, custom filter. add_filter( 'advanced-ads-tracking-do-tracking', 'my_advads_tracking_filter', 10, 3 ); function my_advads_tracking_filter( $status, $ad_id, $table […]

JavaScript event when ads are loaded using Advanced Ads Pro

The following JavaScript code allows you to do something as soon as Advanced Ads Pro finished loading ads. if ( typeof advanced_ads_pro === 'object' ) { advanced_ads_pro.observers.add(function(event) { // Note: These events may be triggered multiple times // because not all ads are injected at the same time. // The injection may be delayed by […]