Last active
December 11, 2019 17:41
-
-
Save nfsarmento/44675ae7053e86779c254c8813496775 to your computer and use it in GitHub Desktop.
Slick Slider ACF/Options shortcode
This file contains 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
// ACF options | |
if( function_exists('acf_add_options_page') ) { | |
acf_add_options_page(array( | |
'page_title' => 'Theme General Settings', | |
'menu_title' => 'Theme Settings', | |
'menu_slug' => 'theme-general-settings', | |
'capability' => 'edit_posts', | |
'redirect' => false | |
)); | |
} | |
// Slick Slider Shortcode | |
function slick_slider_shortcode () { | |
ob_start(); | |
?> | |
<?php if( have_rows('clients_slider', 'option') ): ?> | |
<div class="slider-name js-footer-slider"> | |
<?php while ( have_rows('clients_slider', 'option') ) : the_row(); ?> | |
<div class="slider-container"> | |
<a class="slider__url" href="<?php the_sub_field('slider_url');?>"> | |
<img class="image-slider" src="<?php the_sub_field('slider_image');?>" alt="genium"> | |
</a> | |
</div> | |
<?php endwhile; ?> | |
</div> | |
<style media="screen"> | |
.slick-slide img{ | |
width: 100%; | |
} | |
</style> | |
<?php endif; ?> | |
<?php | |
return ob_get_clean(); | |
} | |
add_shortcode('clientsliders', 'slick_slider_shortcode'); |
This file contains 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
// Slick Slider Script | |
jQuery(document).ready( function(){ | |
$(".js-footer-slider").slick({ | |
infinite: !0, | |
slidesToShow: 7, | |
dots: !1, | |
arrows: !1, | |
autoplay: !0, | |
autoplaySpeed: 1e3, | |
speed: 1e3, | |
responsive: [{ | |
breakpoint: 782, | |
settings: { | |
slidesToShow: 3 | |
} | |
}, { | |
breakpoint: 480, | |
settings: { | |
slidesToShow: 1, | |
slidesToScroll: 1, | |
infinite: true | |
} | |
}] | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment