wordpress 首页置顶文章显示


<?php
     $sticky = get_option('sticky_posts'); 
      query_posts( array('post__in' => $sticky,'caller_get_posts' =>1,'cat'=>6,'showposts'=>6)); 
       static $case_num=0; 
     while (have_posts()) : the_post(); 
     $url=get_gllary(get_the_ID()); ?>
                              // 置顶文章循环内容
<?php $case_num++;
     endwhile; wp_reset_query();  
          $case_num=6-$case_num;//
          query_posts( array( 'post__not_in' => get_option( 'sticky_posts'),'cat'=>6,'showposts'=>$case_num ));
       while (have_posts()) : the_post();
        $url=get_gllary(get_the_ID()); ?>

      //非置顶文章循环内容

      <?php endwhile; wp_reset_query(); ?>      

//循环显示6篇文章,,置顶文章数量不够则自动循环最新文章        

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM