Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialCraig Watson
27,930 PointsHas anyone used slick slider in their WordPress theme ?
Hi everyone,
I have been messing around now for hours trying to get the slick slider js to work in a WordPress theme with Custom Post Types and Advanced Custom Fields.
I have the post loading and content on page looks how I want but the slider it self is not working however the slick files are loading fine because I have switched to the CDN versions to make sure I can get this going before adding the files in.
I an not interested in the slick slider plugin because it does not suit the content I want on the slides.
I tried out slider revolution and again for this purpose is is not suitable.
Any help appreciated!
Craig
3 Answers
Rich Bagley
25,869 PointsHi Craig,
Do you mean this one?
If so, yes I have Slick Slider working on a couple of custom WordPress themes using the CDN for both CSS and JS.
Could it be conflicting with another script?
-Rich
EDIT: Sample code added to comment below.
Michael Escoto
30,028 PointsHi Craig,
Not sure if you're still having this problem but I was having a similar issue. I found this article helpful: http://www.engagewp.com/custom-image-slider-with-advanced-custom-fields-and-slick/
I created a separate init file and switched to using the CDN for the JS files as the article suggests and it seemed to fix my problem.
Jonathon Hyland
5,016 PointsRich Bagley I was looking through this for a wordpress site I'm trying to get this to work on. I have got it all working but it seems as thou the slick-theme.css isn't loading. Any ideas?
Craig Watson
27,930 PointsCraig Watson
27,930 PointsHi Rich,
Yes that's the one, I use it often for simple front end sites but this is the first time I have tried getting it going on a wordpress site.
I have just had a run through the theme js folder and it is using flexslider, could that be conflicting ?
Craig
Rich Bagley
25,869 PointsRich Bagley
25,869 PointsHi Craig,
It's possible. You could try commenting that out temporarily to see if it helps.
When enqueuing the script have you ensured it depends on jQuery?
-Rich
Craig Watson
27,930 PointsCraig Watson
27,930 PointsI have just tried it without that file loading and it stayed the same and yes I didnt at first I must say but I do have it dependent on jQuery now.
What I get on the front end is my slide looking as it should but with a grey button above = Previous and one below = Next which when clicked work as you would expect and the slide move to the next one along.
However the default auto play is not working and when I do set the params in js file to set autoPlay to true both slides show asif set to display block :S very strange
I am wondering if that because the parent theme already has jquery flexslider loading in this case to save requests I should work my template around the flexslider...
One other thing rich, I am looking into starting a side project using WordPress to handle a few of the features and have been keeping my eye out for someone who may be interested in giving it a bash. There is not another site out there IN THE WORLD doing this and it is only through a previous job that I know it could work. Drop me an email craig@digimouse.co.uk if you want a little further detail :)
Craig
Austin Whipple
29,725 PointsAustin Whipple
29,725 PointsI've gotten Slick running with Custom Post Types UI and ACFP without issue. I'd definitely be wary of conflicting JS. If your theme doesn't need it, might as well save the resources anyway and stop it from loading even if it's not the problem.
Rich Bagley
25,869 PointsRich Bagley
25,869 PointsNo problem :) The sites I've integrated it with haven't relied on a parent so it may be a conflict due to the slider already in parent theme as you mention.
-Rich
Craig Watson
27,930 PointsCraig Watson
27,930 PointsHi guys, could one of you help me out getting slick running correctly. I will be needing to use it in the future as its my go to slider when just working with html sites so id really like to have my use of it moved into wordpress to.
Craig
Craig Watson
27,930 PointsCraig Watson
27,930 PointsThis is my code so far,
functions.php
theme-template.php
theme.js
Craig
Rich Bagley
25,869 PointsRich Bagley
25,869 PointsHi Craig,
It doesn't look far off what I have so it's a little odd it's not working. I've made a few tweaks to your code but you may need to add some of your styles back in so I'd recommend backing everything up before trying it just to be safe :)
The WP_Query for whichever PHP page you may need:
functions.php:
jQuery:
Hopefully the above helps you to at least narrow down the problem :)
-Rich