现在教你如何调取wordpress某个分类目录下的文章,很简单,只需几句代码就搞定,把下面的代码放到要显示的地方就OK了
[code]<?php $posts = get_posts( “category=83&numberposts=10″ ); ?>
<?php if( $posts ) : ?>
<ul><?php 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; ?>[/code]
其中的category=4&numberposts=10是控制需要调取分类目录的ID和输出文章的条数,自便修改。
文章来源:个人随笔 香格里拉seo (www.xgllseo.com)转载请注明,请尊重版权。