我在我的 WordPress 网站上使用 Nictitate 主题。
该主题包括一个仅显示客户 Logo 的客户小部件。我注意到主题中的其他小部件正在使用 FlexSlider,因此添加了一些代码以在轮播中获取客户端 Logo 。
但是,我无法让它正常工作。所有 Logo 在第一张幻灯片中组合在一起,然后全部消失。
有人能帮忙吗?
我已将以下代码添加到 widgets.php
:
<div class="clients-slider flexslider">
<ul class="slides">
<?php
while ( $clients->have_posts() ) : $clients->the_post();
$client_url = get_post_meta( get_the_ID(), 'client_url', true );
$thumbnail_id = get_post_thumbnail_id();
$thumbnail = wp_get_attachment_image_src( $thumbnail_id, 'kopa-image-size-4' );
?>
<li>
<a href="<?php echo $client_url; ?>" target="_blank"><img src="<?php echo $thumbnail[0]; ?>" alt=""></a>
</li>
<?php
endwhile; ?>
</ul>
</div>
在 custom.js
中:
jQuery(window).load(function() {
jQuery('.clients-slider').flexslider({
animation: "slide",
animationLoop: false,
itemWidth: 50,
itemMargin: 5,
minItems: 2,
maxItems: 4,
selector: ".slides > li",
start: function(slider) {
jQuery('body').removeClass('loading');
}
});
});
最佳答案
在http://leanneoleary.com/traincoachexcel.co.uk/wp-content/themes/nictitate-1.1.4/style.css第 1084 行
删除这个
.kopa-client-widget ul { width:1100px !important;}
这样做之后,这就是我得到的:
关于javascript - FlexSlider 轮播在第一张幻灯片中滑动所有图像 - WordPress,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33816452/