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