Last active
October 11, 2015 22:38
-
-
Save lvwzhen/3930268 to your computer and use it in GitHub Desktop.
wordpress 首页调用分类目录下的文章
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; | |
$args=array( | |
'cat' => '', // 分类ID,单引号中填写具体ID,在你后台的分类目录中鼠标查找 | |
'posts_per_page' => 5, // 显示篇数 | |
'paged'=>$paged, | |
); | |
query_posts($args); | |
if (have_posts()) : while (have_posts()) : the_post(); | |
?> | |
<div class="poss" id="post-<?php the_ID(); ?>" > | |
<h2><a href="<?php the_permalink() ?>"><?php the_title_attribute(); ?></a></h2> | |
<?php the_content("Read More..."); ?> | |
</div> | |
<?php endwhile; endif; wp_reset_query();?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment