Table of Contents
How to use the Ad Slider
To use the Ad Slider, go to Advanced Ads > Groups and either create a new ad group or change the type of an existing group to “Ad Slider”.
The slider ad group mode works similarly to the ordered ad group. Use the ad weights to determine the order in which the ads appear. In the slider, the ads with the highest ad weight appear first. The higher the ad weight, the further up the chain the ad is placed.
The first new setting is the delay with which each slide is shown.
The second slider-specific option is the “Random order”. Here you can set your slides to appear in a random order on each page load. Please note that ad weights will influence the random order and break the randomization.
To display the ad slider, just use any of the methods described in the ad groups manual.
Ad Slider example
Additional Options
The Slider add-on uses the unslider.js
script. You can adjust settings like the speed, the animation type (horizontal, vertical), or disable options like autoplay using a WordPress filter.
The following is an example you can add to your theme’s functions.php
to adjust speed and animation.
Note: The default animation type has changed to infinite with version 1.4.0 of the Slider Add-On.
Jump back to the first slide
Use the code below to let the slider jump back to the first slide before version 1.4.0.
function restore_slider_behavior( $settings ) {
$settings['infinite'] = 'false';
return $settings;
}
add_filter( 'advanced-ads-slider-settings', 'restore_slider_behavior' );
Code language: PHP (php)
Change options
You can adjust the layout and behavior of the slider using a hook. Please find the sample code for various options below. You can remove those that are not relevant to your use case. Please note that you might need custom CSS to style navigation elements after you enabled them.
function my_slider_adjustments( $settings ) {
$settings['speed'] = 100; // 100 milliseconds
$settings['animation'] = "'fade'"; // change animation to fade, also available: 'vertical', 'horizontal' (default)
$settings['infinite'] = 'false'; // required in combination with the "fade" animation
$settings['nav'] = 'true'; // show navigation buttons below the slider
$settings['arrows'] = 'true'; // show navigation links left and right of the slider
return $settings;
}
add_filter( 'advanced-ads-slider-settings', 'my_slider_adjustments' );
Code language: PHP (php)
Load the unslider scripts from a CDN
In case you want to load the unslider scripts from an external CDN, add the following line to your wp-config.php
.
define( 'ADVANCED_ADS_SLIDER_USE_CDN', true );
Code language: JavaScript (javascript)
Tracking
If you are using the Tracking add-on, the ad impressions will be counted for each ad in the ad slider once with the page load (Frontend, Google Analytics and Database).
When you choose the Frontend method in combination with AJAX Cache Busting, the add-on records an impression for the group’s first ad.
Troubleshooting
Resources
- Check out more option and search the web for “unslider script” to get more information about modifying the slider like this.
- How to rotate ads