如何跳过Wordpress中的第一篇文章?
问题描述:
如何跳过第一篇文章?我使用wordpress。如何跳过Wordpress中的第一篇文章?
<?php
$recentPosts = new WP_Query();
$recentPosts->query(array('showposts' => 6,'post_type' =>array('stiri')));
?>
<?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
感谢
答
使用偏移参数
<?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
改变偏移为1,这是明确清楚OP。 – deefour 2012-07-28 01:20:02
解决了,谢谢我使用:'offset'=> 5, – Batman 2012-07-28 01:23:31