前几日在做一个wordpress主题风格想把全新文章列表和置顶文章列表分离表明,可在读取全新文章列表时发觉,假如wordpressblog有置顶文章内容,那 么全新文章列表也会把blog的置顶文章内容表明在最前边,可是可以根据设定置顶文章内容的主要参数caller_get_posts清除目录中的热门文章。
- <?php
- $post_num = 10; // 表明文章内容的总数.
- $args=array(
- ‘post_status’ => ‘publish’,
- ‘paged’ => $paged,
- ‘caller_get_posts’ => 1,
- ‘posts_per_page’ => $post_num
- );
- query_posts($args);
- // 主循环系统
- if ( have_posts() ) : while ( have_posts() ) : the_post();
- ?>
- <li><a href=“<?php the_permalink() ?>”><?php the_title(); ?></a></li>
- <?php endwhile; else: endif; wp_reset_query();?>
关键编码来自wordpress汉语主题风格站