Created
August 20, 2015 12:38
-
-
Save dsturm/cf56ccc6e4f734506605 to your computer and use it in GitHub Desktop.
Rosa - Slider Shortcode Autoplay
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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