Skip to content

Instantly share code, notes, and snippets.

@tomhemsley
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomhemsley/9247378 to your computer and use it in GitHub Desktop.
Save tomhemsley/9247378 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 on the first slide in the slideshow.
*/
function metaslider_delay_first_slide($options, $slider_id, $settings) {
$delay = 5000; // delay for first slide in milliseconds
$options['start'][] = "slider.pause(); setTimeout(function(){ slider.play(); }, {$delay});" ;
$options['after'][] = "if (slider.currentSlide == 0) { slider.pause(); setTimeout(function(){ slider.play(); }, {$delay}); }" ;
return $options;
}
add_filter('metaslider_flex_slider_parameters', 'metaslider_delay_first_slide', 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment