我在wordpress中使用owl-carousel
,我正试图在site上显示相同的html结果:
<div class="owl-carousel owl-theme owl-loaded">
<div class="owl-stage-outer">
<div class="owl-stage">
<div class="owl-item">...</div>
<div class="owl-item">...</div>
<div class="owl-item">...</div>
</div>
</div>
<div class="owl-controls">
<div class="owl-nav">
<div class="owl-prev">prev</div>
<div class="owl-next">next</div>
</div>
<div class="owl-dots">
<div class="owl-dot active"><span></span></div>
<div class="owl-dot"><span></span></div>
<div class="owl-dot"><span></span></div>
</div>
</div>
</div>
正如您所看到的那样,owl-stage-outer
包含滑块的项目,在底部我们可以找到包含要向右或向左导航的按钮的owl-controls
类。
现在在wordpress我有这个模板结构:
<div id="owl-featured" class="owl-carousel owl-theme">
<?php //Check if only one post is featured ?>
<?php if ( is_home() && !is_paged() && ( ot_get_option('featured-posts-count') == '1') && $featured->have_posts() ): // No slider if 1 post is featured ?>
<?php while ($featured->have_posts() ): $featured->the_post(); ?>
<?php get_template_part('content-featured'); ?>
<?php endwhile; ?>
<?php elseif ( is_home() && !is_paged() && ( ot_get_option('featured-posts-count') !='0') && $featured->have_posts() ): // Show slider if posts are not 1 or 0 ?>
<?php while ( $featured->have_posts() ): $featured->the_post(); ?>
<?php get_template_part('content-featured'); ?>
<?php endwhile; ?>
<?php endif; ?>
<div class="owl-controls">
<div class="owl-pagination"></div>
<div class="owl-buttons"></div>
</div>
</div>
我已经创建了一个div作为轮播容器,在其中我插入了wordpress查询以获取内容,现在你可以在条件结束时看到{{1} },实际上我需要在owl-controls
之外获得控件,如第一个提供的示例所示,但我得到的结果如下:
owl-wrapper
你可以看到<div id="owl-featured" class="owl-carousel owl-theme">
<div class="owl-wrapper-outer">
<div class="owl-wrapper">
<div class="owl-item">
<div class="owl-item">
...
...
<div class="owl-item">
<div class="owl-controls">
<div class="owl-pagination"></div>
<div class="owl-buttons"></div>
</div>
</div>
</div>
</div>
</div>
在owl-controls
里面,我不明白为什么会发生这种情况,我从三小时开始坚持这个,我无法找到解决办法
PS:这是滑块的js初始化:
owl-item
有人知道这个错误在哪里?
答案 0 :(得分:0)
<h4>number</h4>
&#34;;(大多数情况下都应该这样做);