Custom post type owl slider showing properly,am creating custom post type and using owl carousel slider register function, but short code loop working properly..

custom owl slider short code

function custom_owl($para,$content){
$para = shortcode_atts ( array(
'' => '',
), $para);ob_start();  
$cutting_slider = null;
$cutting_slider = new WP_Query( array ('post_type'     => 'custom_cuttingsystem','posts_per_page' => -1,'orderby' => 'rand'));
if($cutting_slider->have_posts()) {
while ( $cutting_slider->have_posts()) {
$cutting_slider->the_post(); ?>
<div class="owl-carousel owl-theme">
<div class="item">
<?php the_post_thumbnail ();?>
<a href="<?php the_permalink() ?>">
<h4><?php the_title(); ?></h4></a>
<span><?php the_category(); ?></span>
<?php }}
$cutting_slider = null; return ob_get_clean();
add_shortcode ('owl-slider','custom_owl');


$(document).ready(function() {


autoPlay: 3000, //Set AutoPlay to 3 seconds

items: 4,
itemsDesktop: [1199, 3],
itemsDesktopSmall: [979, 3]});});

register child theme owl function 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'), NULL, true);

 // wp_enqueue_script('owl-jq', get_stylesheet_directory_uri().'/owl/jquery.min.js', array('jquery'), NULL, true);
add_action( 'wp_enqueue_scripts', 'custom_owlcarousel' );

Read more here: custom post type slider not showing


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: