A
A
angry_yum2018-02-22 02:40:48
JavaScript
angry_yum, 2018-02-22 02:40:48

How to enable slick slide in wordpress?

Hello. Can you suggest, or poke where you can read how to enable slick slide in wordpress. For, I made a layout, everything works fine, the slider works, but as soon as I try to transfer the layout to WP, the slider simply does not turn on and that's it. Sorry if this is a dumb question, I couldn't find anything myself.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Orkhan Hasanli, 2018-02-22
@angry_yum

Hello!
All scripts and styles are connected via functions.php
Create css js fonts folders, drop styles and slick scripts there.
Open functions
add code
// include styles and scripts

function register_styles_scripts() {
  //стили
  wp_register_style('style', get_template_directory_uri() .
    '/style.css');
  wp_enqueue_style('style');
  
  //скрипты
  wp_register_script('slick', get_template_directory_uri() .
    '/js/jquery.js');
  wp_enqueue_script('slick');
  
}
add_action('wp_enqueue_scripts', 'register_styles_scripts');

Also include the script of the slider itself for slick.
If it doesn't "work", then replace all $ with jQuery
or wrap the code in
$.noConflict();
jQuery( document ).ready(function( $ ) {
......
});

D
Dashunia, 2018-08-07
@Dashunia

You can also take into account the dependency of slick.js on jquery.js, for this, in the functions.php theme folder of the WP theme, for example:

// Подключаем jquery
wp_enqueue_script('my-jquery', get_template_directory_uri() . '/assets/js/jquery-3.2.1.slim.min.js');
// Подключая slick, учитываем зависимость от jquery
wp_enqueue_script('my-slick', get_template_directory_uri() . '/assets/slick/slick.js', array('my-jquery'), null, true);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question