我的wp\\u查询从第五个开始获取帖子,继续它是前四个的另一个循环,出于样式的原因。
如果这些帖子存在,我如何有条件地获得它们的包装?
我能让它工作的唯一方法是让容器在循环前后“正确悬挂”,显然,如果我把它放在循环中,它吐出的标记只有两个ul。
<?php echo(\'<ul class="right-hang">\'); ?>
<?php $featuredPosts = new WP_Query(); ?>
<?php $featuredPosts->query(\'showposts=2&cat=6&offset=4\'); ?>
<?php while ($featuredPosts->have_posts()) : $featuredPosts->the_post(); ?>
<li class="non-stacked">
<a href="<?php the_permalink() ?>">
<?php the_post_thumbnail(\'extrathumb\'); ?>
<span><?php the_title(); ?></span>
<span class="f-category">
<?php
$category = get_the_category();
echo $category[0]->cat_name;
?>
</span>
</a>
</li>
<?php endwhile; ?>
<?php echo \'</ul>\'; ?>