WordPress Owl转盘添加图像问题-PHP
我正试图获得更进一步的,新的图像链接加载显示 目前显示了5个,但我们希望添加第六个&将来可能会有2到3个 我们遇到的问题是,当我们添加第六个时,它会覆盖现有5个中的一个 有人能帮忙吗,我怀疑是功能,让我们添加更多 谢谢 HTMLWordPress Owl转盘添加图像问题-PHP,php,wordpress,owl-carousel,Php,Wordpress,Owl Carousel,我正试图获得更进一步的,新的图像链接加载显示 目前显示了5个,但我们希望添加第六个&将来可能会有2到3个 我们遇到的问题是,当我们添加第六个时,它会覆盖现有5个中的一个 有人能帮忙吗,我怀疑是功能,让我们添加更多 谢谢 HTML 打电话给我们 PHP 函数vvwc_carouselList($posts,$postId=null){ 如果(!空($posts)){ 回声' '; $x=1; foreach($posts作为$post){ $active=''; $feature='';
打电话给我们
PHP
函数vvwc_carouselList($posts,$postId=null){
如果(!空($posts)){
回声'
';
$x=1;
foreach($posts作为$post){
$active='';
$feature='';
如果($postId==$post->ID){
$active='active';
$feature='feature';
}
如果($x==5 | |$x==1){
?>
找到它后,我替换了:
$posts=get_posts('category='.$cat);
与
$posts=get\u posts(数组)(
“类别”=>15,
'orderby'=>'title',
“每页帖子数”=>10,
“订单”=>“ASC”,
));
尝试将项目设置为6
<div class="content">
<div class="visible-xs visible-sm" style="background: #367586;color: white;width: 100%;">
<h2 style="color: white;padding: 20px;text-align: center;">Call us on <a style="text-decoration: none;color: white;" href="tel:0141999999">0131 344 4146</a></h2>
</div>
<div class="pageTitle">
<h1><?php single_cat_title(); ?></h1>
</div>
<?php
$posts = get_posts('category='.$cat);
vvwc_carouselList($posts);
?>
<div class="clearfix"></div>
function vvwc_carouselList($posts, $postId=null){
if(!empty($posts)){
echo '
<div class="nonCarousel">
<ul class="list-inline">
';
$x = 1;
foreach($posts as $post){
$active = '';
$feature = '';
if($postId == $post->ID){
$active = 'active';
$feature = 'feature';
}
if($x == 5 || $x == 1){
?>
<div class='row'>
<?php
}
echo '
<li class="col-md-3 '.$feature.'">
<div class="'.$active.' carousel-border">
<div class="carousel-item">
<a data-item="'.$post->ID.'" href="'.get_permalink($post->ID).'">
';
if(has_post_thumbnail($post->ID)){
echo get_the_post_thumbnail($post->ID);
}
echo "<div class='camperTitle'>" . strtoupper($post->post_title) . "</div>";
echo '
</a>
</div>
</div>
</li>
';
if($x == 4 || $x == count($posts)+1 ){
?>
</div>
<?php
}
$x ++;
}
echo '
</ul>
<div class="clearfix"></div>
</div>
';
}
echo '
<div class="clearfix"></div>
<script>
jQuery(document).ready(function($){
$(".carousel ul").owlCarousel({
items: 4,
pagination: false,
navigation: true,
navigationText: false,
slideSpeed: 1000,
rewindSpeed: 1000
});
});
</script>
';