首页 > 解决方案 > 猫头鹰轮播未在 wordpress 主题上显示

问题描述

我在 WordPress 主题中插入了一个轮播,但它无法在前端显示。

在我的代码下面:

<link rel="stylesheet" href="http://owlcarousel2.github.io/OwlCarousel2/assets/owlcarousel/assets/owl.carousel.min.css">
<link rel="stylesheet" href="http://owlcarousel2.github.io/OwlCarousel2/assets/owlcarousel/assets/owl.theme.default.min.css">
<script src="http://owlcarousel2.github.io/OwlCarousel2/assets/owlcarousel/owl.carousel.js"></script>       
<div class="owl-carousel">
<?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
<div>
<div class="col-md-4">
<div class="product-border">
<div class="col-md-12" style="height:75%";>
<?php the_post_thumbnail();?>
</div>
<div class="col-md-12 product-title" style="height:25%";>
<div class="col-md-8">
<?php $perma = get_the_permalink(); ?>
<h2><a href="<?php echo $perma; ?>"><?php the_title(); ?></a></h2>
</div>
<div class="col-md-4">
<a href="<?php echo $perma; ?>" style="font-size: 35px;color:  #000;background-color: #D7D7D7;padding: 14px;float: right;margin-right: -31px;"> 
<p>→&lt;/p></a>
</div>

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

<script>
jQuery(document).ready(function(){
    jQuery(".owl-carousel").owlCarousel();
});
</script>

我使用猫头鹰轮播,但这没有显示在我的主题中

标签: wordpressowl-carousel

解决方案


我得到了答案只需在 main 之外使用此查询div


推荐阅读