我在 WordPress 循环中配置 BX Slider 寻呼机缩略图滑块时遇到了困难。这是我设置的:
<?php
global $post;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'category_name' => 'BX',
'numberposts' => '-1',
'order' => 'ASC'
);
$services_posts = get_posts($args);
?>
<div class="span8">
<ul class="bxslider">
<?php $count=0;foreach($services_posts as $post) : setup_postdata($post);$count++; ?>
<?php $bx_large = wp_get_attachment_image_src(get_post_thumbnail_id(), 'bx-large'); ?>
<li id="slider-<?php echo $count; ?>"><img src="<?php echo $bx_large[0]; ?>" height="<?php echo $bx_large[2]; ?>" width="<?php echo $bx_large[1]; ?>" alt="Image"></li>
<?php endforeach; ?>
</ul>
</div>
<div class="span4">
<div id="bx-pager">
<div class="row-fluid">
<?php $count=0;foreach($services_posts as $post) : setup_postdata($post); $count++; ?>
<?php $bx_small = wp_get_attachment_image_src(get_post_thumbnail_id(), 'bx-small'); ?>
<a data-slide-index="" href="#slider-<?php echo $count; ?>"><img src="<?php echo $bx_small[0]; ?>" height="<?php echo $bx_small[2]; ?>" width="<?php echo $bx_small[1]; ?>" alt="Image"></a>
<?php endforeach; ?>
</div>
</div>
</div>
这张幻灯片一次就没有了。似乎归结为:
data-slide-index
不知道该怎么办。我尝试将 $count 添加到它,但它没有用。有点不知所措。
谢谢你的帮助!