I am trying to use slick slider and want to display 3 authors per slide with following code.

//get all users list
foreach($authors as $author){
<div class="sidebar-authors-custom better-slider" id="sidebar-authors-custom">
    foreach($authorList as $author){
        $query = new WP_Query($args);
        if($query->have_posts() ) {
            while ($query->have_posts()){
    <?php if($author['id'] != 1){ ?>
      <a href="<?php echo get_permalink(); ?>"><div class="author">
            <div class="profile-img">
            <?php echo get_avatar( $author['id'] , 80); ?>
            </div><div class="profile-info"><span class="name"><?php echo $author['name']; ?></span>
            <span class="title"><?php echo get_the_title(); ?></span></div></div></a>
      <?php }}}} ?></div>

I added following lines to my functions.php in order to get CSS and JS files of slick slider properly. I checked from the source and it works.

    //Additional CSS
    wp_enqueue_style( 'slick', get_template_directory_uri() . '/css/slick.css');

    //Additional JS
    wp_enqueue_script( 'slick', get_template_directory_uri() . '/js/slick.js', array ( 'jquery' ), 1.1, false);

I added the following lines both in slick.js file and the page from WP Bakery interface which should fire the slider and load its components within DOM. (I altered JQuery to Vanilla JS for the page)

  dots: true,
  infinite: true,
  speed: 300,
  slidesToShow: 1,
  adaptiveHeight: true

But I see no changes and have no issues on console. I thought maybe it is about the JQuery version and tried the following code either.

wp_register_script( 'jquery3.2.1', 'https://code.jquery.com/jquery-3.2.1.min.js' );
wp_add_inline_script( 'jquery3.2.1', 'var jQuery3_2_1 = $.noConflict(true);' );
wp_enqueue_script( 'plugin-javascript', plugins_url( 'js.js', __FILE__ ), array( 'jquery3.2.1' ) );

Still no changes. Could anyone help me with that?

  • Try with jQuery(document).ready(function($){ – Sally CJ Jul 8 '18 at 13:00
  • Tried just now but still no changes @SallyCJ – Özgür Polat Jul 8 '18 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.