調用網站最新文章:
<?php
query_posts('showposts=10&orderby=new'); //showposts=10表示10篇
while(have_posts()): the_post();
?>
//這裏可以寫成你自己需要的樣式
<li><a href="<?php the_permalink(); ?>" target="_blank"><?php the_title();?> <?php the_time('Y-m-d'); ?></a></li>
<?php endwhile; ?>
調用隨機文章:
query_posts('showposts=10&orderby=rand');
調用某個分類下的最新文章:
query_posts('showposts=10&cat=1'); //cat=1爲調用ID爲1的分類下文章
排除某個分類下的文章:
query_posts('showposts=10&cat=-1'); //cat=-1爲排除ID爲1的分類下文章