2012-07-28 47 views
4

如何跳過第一篇文章?我使用wordpress。如何跳過Wordpress中的第一篇文章?

<?php 
$recentPosts = new WP_Query(); 
$recentPosts->query(array('showposts' => 6,'post_type' =>array('stiri'))); 
?> 
<?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?> 

感謝

回答

11

使用偏移參數

<?php 
$recentPosts = new WP_Query('offset=1')); 
$recentPosts->query(array('showposts' => 6,'post_type' =>array('stiri'))); 
?> 
<?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?> 

http://codex.wordpress.org/Class_Reference/WP_Query#Offset_Parameter

+2

改變偏移爲1,這是明確清楚OP。 – deefour 2012-07-28 01:20:02

+0

解決了,謝謝我使用:'offset'=> 5, – Batman 2012-07-28 01:23:31

相關問題