Paeon Slider on Custom Page Template
This support request was posted in Paeon by PrositesAU
- PrositesAU June 8, 2016 at 5:23 am
Hi!
User wlpdrpat posted this query also, but your suggestion doesn’t work. We have done similar to wlpdrpat, created a custom home template – in fact we have created a few different options for clients and simply want to be able to select them as templates within the editor. We had already worked out that the IF statement in the header.php needed changing, and have done so accordingly. We have confirmed that it gets into the loop, so our IF modification is working – it’s recognising our template(s). The slides are actually being created, but for some reason the Flexslider code isn’t loading in the HEAD of the page, so the slider never fires. We have noticed that the BODY also never gets the .has-slider class added to it.
Your guidance would be greatly appreciated.
Regards,
SteveRicardo Aiello June 8, 2016 at 12:20 pmHi Steve,
Thanks for reaching us, and for being so clear in your support request 🙂
Here you have a code snippet to place in your functions.php file, which will allow you to load FlexSlider script in all pages. Of course, you could customize it to load only in specific pages, if you wanted.
Please let me know if this solves your issue, and if I can be of further assistance.
Best,
Ricardo
PrositesAU June 10, 2016 at 12:07 amHi Ricardo,
Thank you for that, it works perfectly for loading the slider, however there is still one weird issue. The “has-slider” class isn’t being added to the BODY of the new template when it’s loaded, so the “header” has a solid background – you can see it here:
If we inspect the page and add the class to the body it works. Obviously we could just add some code (javascript) to the template to manually force that class onto the body, but I’d prefer not to do it client side if possible. it’s just a bit weird that it’s not being added. Any ideas?
Thanks again,
SteveRicardo Aiello June 10, 2016 at 12:00 pmHi Steve,
You’re right. Here you have an improved snippet to replace the old one. This one will:
– check if the current template has a slider;
– if it has, check if there is at least one slide available;
– and if it is, load FlexSlider script and add the slider body classes.Remember to add your own template names to the $slider_templates array (check line 18 of the snippet), that’s how you tell Paeon those templates are using the slider. This way the classes and script are only added when they are needed.
Please let me know if this solves your issue, and if I can be of further assistance.
Best,
Ricardo
PrositesAU June 14, 2016 at 11:34 pmHi Ricardo,
Excellent! Nice elegant solution. It now works very nicely. Thank you!
Regards,
SteveRicardo Aiello June 15, 2016 at 12:19 pmHi Steve,
You’re welcome!
Don’t hesitate to write again if you run into any issues.
Best,
Ricardo
This topic is marked as resolved
Only the topic author can re-open this thread.