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. However, there is a significant difference between the ordered ad group. In the slider, the ads with the lowest ad weight appear first. The lower the ad weight, the further up the chain the ad is placed.
The only new setting is the delay with which each slide is shown.
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
Advanced Ads tracks each ad in the ad slider once with the page load. Compared to this, ads loaded with the refresh on the same spot option are tracked only once they become visible for the first time.
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