下面这两段代码都可以通过&offset=4排除该分类前4篇最新文章,从第5篇开始调用分类列表
代码一:
<?php $posts = get_posts("category=1&offset=4&numberposts=5"); ?>
<ul><?php if( $posts ) : foreach( $posts as $post ) : setup_postdata( $post); ?>
<li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
代码二:
<?php query_posts('showposts=5&cat=1&offset=4'); ?>
<ul>
<?php while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink() ?>" rel="bookmark" class="title"><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
调用第5-10置顶文章
<?php
$args = array(
'posts_per_page' => 5,
'offset' => 4,
'post__in' => get_option('sticky_posts'),
'ignore_sticky_posts' => 1
);
query_posts($args);
?>
<?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?>
<ul><li><h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2></li></ul>
<?php endwhile; ?>
<?php endif; ?>