<?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()没结果求思路调试这段代码,让他成功循环执行循环体
 

解决方案 »

  1.   

    end while 在哪?没看到?
      

  2.   

    小写看不到,下次换大写大号字体的,呵呵
    echo $features;//这个,直接echo 对象?此外,不晓得你的the_post()方法的内容,没法判断为何是空值;<li>显示的次数是预想值么?
      

  3.   

    echo $features;  这个是我调试的代码...
    have_posts()返回1
    返回空
    不执行<li>
      

  4.   

    似乎错误在你的类the_post()里面产生导致程序中断