Answer the question
In order to leave comments, you need to log in
Slick Slider not working in Wordpress?
Good afternoon , installed vp , included styles and scripts via fanctions.php . I have a slick-slider under the menu. It is not displayed as a slider, but is displayed in 4 lines. Re-registered jquery . Did not help. Responsive menu works, probably not in jquery problem.
<?php
add_action( 'wp_enqueue_scripts' , 'my_styles' );
add_action( 'wp_enqueue_scripts', 'my_scripts' );
add_action( 'wp_enqueue_scripts', 'my_lol' );
function my_styles(){
wp_enqueue_style('style', get_stylesheet_directory_uri());
wp_enqueue_style('stylecss' , get_template_directory_uri() . '/assets/css/style.css');
wp_enqueue_style('slicktheme' , get_template_directory_uri() . '/assets/css/slick-theme.css');
wp_enqueue_style('slick' , get_template_directory_uri() . '/assets/css/slick.css');
wp_enqueue_style('bootstrap' , get_template_directory_uri() . '/assets/css/bootstrap.css');
wp_enqueue_style('bootstrapmin' , get_template_directory_uri() . '/assets/css/bootstrap.min.css');
}
function my_scripts() {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', get_template_directory_uri() . '/assets/js/jquery-3.4.1.min.js' );
wp_enqueue_script( 'jquery' );
wp_enqueue_script('popper', 'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js');
wp_enqueue_script('slickjs', get_template_directory_uri() . '/assets/js/slick.min.js', ['jquery']);
wp_enqueue_script('bootstrapjs', get_template_directory_uri() . '/assets/js/bootstrap.min.js', ['jquery']);
wp_enqueue_script('common', get_template_directory_uri() . '/assets/js/common.js', ['jquery']);
wp_enqueue_script('kit', 'https://kit.fontawesome.com/3ada3c02e7.js');
}
function my_lol() {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', get_template_directory_uri() . '/assets/js/jquery-3.4.1.min.js');
wp_enqueue_script( 'jquery' );
}
Answer the question
In order to leave comments, you need to log in
Follow my example .. WordPress already connects jQuery for you, you just need to register dependencies for it.
function theme_scripts() {
wp_enqueue_style( 'theme-style', get_stylesheet_uri() );
// Custom scripts
wp_enqueue_script( 'custom-common', get_template_directory_uri() . '/js/common.js', array('jquery'), null, true );
// Bootstrap
wp_enqueue_script( 'bootstrap-popper', '//cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js', array('jquery'), null, true );
wp_enqueue_script( 'bootstrap-min', '//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js', array('jquery'), null, true );
// Owl carousel JS
wp_enqueue_script( 'owl-carousel', get_template_directory_uri() . '/libs/owl-carousel/owl.carousel.min.js', array('jquery'), null, true );
// Phone mask
wp_enqueue_script( 'masket', get_template_directory_uri() . '/libs/inputmask/inputmask.js', array('jquery'), null, true );
wp_enqueue_script( 'extensions', get_template_directory_uri() . '/libs/inputmask/inputmask.extensions.js', array('jquery'), null, true );
wp_enqueue_script( 'num-extensions', get_template_directory_uri() . '/libs/inputmask/inputmask.numeric.extensions.js', array('jquery'), null, true );
wp_enqueue_script( 'inputmask', get_template_directory_uri() . '/libs/inputmask/jquery.inputmask.js', array('jquery'), null, true );
}
add_action( 'wp_enqueue_scripts', 'theme_scripts' );
jQuery( document ).ready(function( $ ){
//code
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question