<?php $features = new WP_query(); $features->query('showposts='.$comfy['featured_n'].'&cat='.$comfy['featured']);?>
<ul id="featuredposts" class="featuredposts"> <?php while ($features->have_posts()) : $features->the_post();?>
<li><a href="#" rel="post-<?php the_ID(); ?>" class="selected"></a></li>
<?php echo $features;?>
<?php endwhile; ?>
</ul><div class="clear"></div>
<!----------------------->
获取有图片的文章 做成幻灯片显示在首页
但是循环体中的根本不会循环 打印have_posts()出的结果是1 the_post()没结果求思路调试这段代码,让他成功循环执行循环体
echo $features;//这个,直接echo 对象?此外,不晓得你的the_post()方法的内容,没法判断为何是空值;<li>显示的次数是预想值么?
have_posts()返回1
返回空
不执行<li>