wordpress cpt multiple owl carousel not working properly…the slider contents are listing down…instead of scrolling

enter image description here

owl carousel enqueue script

function custom_owlcarousel() {

wp_enqueue_style('owlmin-css', get_stylesheet_directory_uri().'/owl/owl.carousel.min.css', 'all');

wp_enqueue_style('owldefault', get_stylesheet_directory_uri().'/owl/owl.theme.default.min.css', 'all');

wp_enqueue_script('carousel-js', get_stylesheet_directory_uri().'/owl/owl.carousel.js', array('jquery'), false, true); 

wp_enqueue_script('global', get_stylesheet_directory_uri().'/boot/custom.js', array('jquery'), NULL, true);

}
add_action( 'wp_enqueue_scripts', 'custom_owlcarousel' );

custom js script

$('.owl-carousel').owlCarousel({
margin: 0,
responsiveClass: true,
smartSpeed: 500,
dots: ($(".owl-carousel .item").length > 1) ? true: false,
loop:($(".owl-carousel .item").length > 1) ? true: false,
responsive: {
    0: {
        items: 1,
    },
    500: {
        items: 1,
    },
    768: {
        items: 1,
    }
} 
}); 

CPT Shortcode Loop

function custom_owl($para,$content){
$para = shortcode_atts ( array(
'' => '',), $para);
ob_start();  

$args=array('post_type'=>'custom_cuttingsystem');
$loop=new WP_Query($args);
if($loop->have_posts()): ?>
     <section class="slider">
          <div class="main-slider">
              <?php while($loop->have_posts()):$loop->the_post();?>
                        <div class="item">
                            <?php the_post_thumbnail(); ?>
                            <div class="slider-content">
                                <div class="container">
                                    <div class="title">
                                        <h1><?php the_title();?></h1>

                                    </div>
                                </div>
                            </div>
                        </div>
                    <?php
                    endwhile;
              ?>
           </div>
     </section>

    <?php
         else:
    echo'<p>No Content Found</p>';
endif;
wp_reset_postdata();
$loop = null; 
return ob_get_clean();}
add_shortcode ('owl-slider','custom_owl');

Read more here: wordpress cpt multiple owl carousel not working properly…the slider contents are listing down…instead of scrolling

Leave a Reply

Your email address will not be published. Required fields are marked *