所以我试图为这个wp\\u查询吐出无限数量的帖子,每次6篇,每一篇都用<dd>
这样它就可以使用jQuery滑块。问题是,如果我正好有6个帖子,或者12个帖子,我最后会有一个帖子是空的<dd></dd>
在最后。我做错了吗,或者这是对Wordpress的限制?
<dl><!--slider container-->
<dd><!--slide-->
<?php $our_work1 = new WP_Query(array(
\'post_type\' => \'our-work\',
\'posts_per_page\' => -1,
\'meta_key\' => \'featured_work\',
\'meta_value\' => \'yes\',
) ); ?>
<?php $count = 1; while ($our_work1->have_posts()) : $our_work1->the_post(); ?><!-- wp_query spits out unlimited posts meeting custom post type / meta criteria -->
<article></article><!--post stuff goes here-->
<?php if ($count % 6 == 0){ ?><!--spits out 6 posts per slide/<dd> -->
</dd><!--close slide-->
<dd><!-- starts next slide with set of 6 posts -->
<?php } $count++; ?>
<?php endwhile; ?><!--ends loop-->
</dd><!-- close set of work items-->
</dl><!--closes slide container-->