Skip to content

Instantly share code, notes, and snippets.

@tomhemsley
Created February 27, 2014 10:07
Show Gist options
  • Save tomhemsley/9247444 to your computer and use it in GitHub Desktop.
Save tomhemsley/9247444 to your computer and use it in GitHub Desktop.
/**
* INSTALLATION: this code should be pasted into your theme's functions.php file.
*
* Use this filter to set a custom delay time on any slide in the slideshow
* ... apart from the first slide! If you need to delay the first slide
* ... see https://gist.github.com/tomhemsley/9247378
*/
function metaslider_delay_slide($options, $slider_id, $settings) {
$delay = 5000; // delay in milliseconds
$slide_to_delay = 2; // 1 = first, 2 == second..
$options['after'][] = "if (slider.currentSlide == ({$slide_to_delay} - 1)) { slider.pause(); setTimeout(function(){ slider.play(); }, {$delay}); }" ;
return $options;
}
add_filter('metaslider_flex_slider_parameters', 'metaslider_delay_slide', 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment