Skip to content

Instantly share code, notes, and snippets.

@simplethemes
Created August 20, 2015 08:53
Show Gist options
  • Save simplethemes/d5bd0a564bb93e19a1e9 to your computer and use it in GitHub Desktop.
Save simplethemes/d5bd0a564bb93e19a1e9 to your computer and use it in GitHub Desktop.
// Enqueue the Slick slider CSS
function child_css() {
wp_enqueue_style('slick', get_stylesheet_directory_uri().'/slick/slick.css', array('style'), '1.0', 'screen, projection');
wp_enqueue_style('slick-theme', get_stylesheet_directory_uri().'/slick/slick-theme.css', array('style'), '1.0', 'screen, projection');
}
add_filter( 'add_stylesheets','child_css' );
// Enqueue the Slick slider Javascripts
function child_scripts() {
wp_enqueue_script('slick', get_stylesheet_directory_uri()."/slick/slick.min.js",array('jquery'),'1.0',false);
wp_enqueue_script('slick-custom', get_stylesheet_directory_uri()."/slick/slider.js",array('jquery'),'1.0',false);
}
add_filter( 'add_scripts','child_scripts' );
// Display the slider on the front page
function slick_slider() {
if (is_front_page()) : ?>
<div id="slick">
<!-- Slide 1 with caption -->
<div class="slide">
<div class="caption">
<div class="inner">
<h1>Caption</h1>
<a class="button pull-right" href="#">Button</a>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
</div>
</div>
<img src="http://f.cl.ly/items/0p1u0A3E1l0j1P0X0c2d/photo-1433354359170-23a4ae7338c6.jpg" alt="img"/>
</div>
<!-- Slide 2 -->
<div class="slide">
<img src="http://f.cl.ly/items/2S2s0n3f0E2K1w212O0U/photo-1436891620584-47fd0e565afb.jpg" alt="img"/>
</div>
<!-- Slide 3 -->
<div class="slide">
<img src="http://f.cl.ly/items/46183N3e1y1c0E1i0s1G/photo-1437422061949-f6efbde0a471.jpg" alt="img"/>
</div>
</div>
<?php endif;
}
add_action( 'st_after_header', 'slick_slider',1);
jQuery(document).ready(function($) {
$('#slick').slick({
slide: '.slide',
dots: true,
arrows: true,
infinite: true,
speed: 300,
slidesToShow: 1,
adaptiveHeight: false
});
});
/* Mobius Slick Slider */
#slick {
position: relative;
}
#slick ul.slick-dots {
margin: 0 !important;
padding: 0 !important;
}
#slick button {
color: transparent !important;
box-shadow: none !important;
text-shadow:none !important;
z-index: 999;
}
#slick .slick-prev {
left: 0px;
position: absolute;
}
#slick .slick-next {
right: 25px;
position: absolute;
}
#slick .slide {
position: relative;
width: 100%;
}
#slick .slide img {
width: 100%;
}
#slick .slide .caption {
position: absolute;
background: rgba(0,0,0,0.75);
bottom:0;
width: 100%;
}
#slick .slide .caption .inner {
padding: 20px;
}
#slick .slide .caption h1 {
color: #fff;
font-size: 1.5em;
margin:0 0 .5em 0;
}
#slick .slide .caption p {
color: #fff;
margin: 0;
}
#slick .slide .caption a.button {
padding: 10px 20px;
margin: 0px 0px 20px 20px;
box-shadow: none !important;
display: inline-block;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment