wordpress调用第一篇最新文章代码和去除第一篇

厄,到处游荡 看到下面的代码就复制,粘贴过来了。第六感告诉我以后俺会用得到的………%…¥^ 6¥wordpress调用第一篇最新文章代码和去除第一篇

<?php query_posts('showposts=1′); while (have_posts()) : the_post(); ?>

<h3><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a></h3>

<?php the_excerpt('Continue Reading &raquo;'); ?>

<?php endwhile; ?>

'showposts=1′表示选取第一篇文章哦

<?php query_posts('showposts=4&offset=1′); while (have_posts()) : the_post(); ?>

'showposts=4&offset=1′); 表示选取4篇文章,去除第一篇文章,也就是选取除去第一篇文章外的最新4篇文章

<?php query_posts('showposts=4&offset=1&cat=2′); while (have_posts()) : the_post(); ?>

'showposts=4&offset=1&cat=2′ 表示选取分类ID为2的4篇文章,去除分类ID为2第一篇文章,也就是选取除去第一篇文章外的最新4篇文章

声明: 未经本站许可,谢绝转载!

4 个主题帖 其中:热心观众:0 个, 管理员:0 个

  1. 谢谢你的代码,举一反三终于解决了!博主是WP百科网的VIP吗?

    2011-11-28 17:15
    • @Byrui Design: 不是啊,为什么这么说呢?我是自己是搞设计的。

      2011-11-29 04:43
    • @Byrui Design: 那些什么VIP是抗人的,自己学习,丰衣足食,不难的。

      2011-11-29 04:47
  2. 萨龙龙
    0楼
    萨龙龙:

    方法不错,这样就可以设置一篇与众不同的文章了

    2014-07-09 15:31

抱歉,评论被关闭