Skip to content

Instantly share code, notes, and snippets.

@dsturm
Created August 20, 2015 12:38
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 dsturm/cf56ccc6e4f734506605 to your computer and use it in GitHub Desktop.
Save dsturm/cf56ccc6e4f734506605 to your computer and use it in GitHub Desktop.
Rosa - Slider Shortcode Autoplay
$autoplay = '';
// if shortcode has attribute "autoplay", use autoplay on slider
if ( isset($atts['autoplay']) ) {
$delay = (int)$atts['autoplay'];
$autoplay = ' data-sliderautoplay=""';
if ( 0 < $delay ) {
// if $delay < 1000, suppose value unit is meant to be seconds
if ( 1000 > $delay ) {
$delay*= 1000;
}
$autoplay.= ' data-sliderdelay="' . $delay . '"';
}
}
$return_string = '<div class="pixcode-slider pixslider js-pixslider" ' . $navigation_style . ' data-slidertransition="' . $custom_slider_transition . '"' . $autoplay . '>';
$return_string .= do_shortcode( $content );
$return_string .= '</div>';
echo $return_string;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment