Skip to content

Instantly share code, notes, and snippets.

@ThatGuySam
Created February 13, 2013 16:04
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 ThatGuySam/4945645 to your computer and use it in GitHub Desktop.
Save ThatGuySam/4945645 to your computer and use it in GitHub Desktop.
<div id="hero-carousel" class="sliderContainer visibleNearby fullWidth clearfix royalSlider-preview">
<div id="hero-gallery" class="royalSlider rsDefault">
<?php
function gallery_func( $atts ) {
extract( shortcode_atts( array(
'ids' => 'something'
), $atts ) );
$sep_ids = explode(",", $ids);
foreach($sep_ids as $img) {
$image_src = wp_get_attachment_image_src( $img, full );
echo '<div class="rs-div" style="background-image:url(' . $image_src[0] . '); padding-top:68.1%;" ></div>';
}
}
add_shortcode( 'gallery', 'gallery_func' );
the_field('carousel_images'); ?>
</div>
</div>
<script id="addJS">jQuery(document).ready(function($) {
var si = $('#hero-gallery').royalSlider({
sliderDrag: false,
addActiveClass: true,
arrowsNav: true,
arrowsNavAutoHide: false,
controlNavigation: 'bullets',
autoScaleSlider: true,
autoScaleSliderWidth: 47,
autoScaleSliderHeight: 32,
loop: true,
fadeinLoadedSlide: true,
globalCaption: true,
keyboardNavEnabled: true,
slidesSpacing: 0,
arrowsNavHideOnTouch: true,
autoPlay: {
// autoplay options go gere
enabled: true,
pauseOnHover: true,
delay: 10000,
}
}).data('royalSlider');
// link to fifth slide from slider description.
$('.slide4link').click(function(e) {
si.goTo(4);
return false;
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment