首页 > Wordpress > wordpress调用指定分类文章列表
2011八月2

wordpress调用指定分类文章列表

直接显示的是:

<?php query_posts(‘cat=1&posts_per_page=’.get_option(‘posts_per_page’)); ?>

自己可编辑代码的是:

<ul id=”cat_related”>
<?php
$args = array(
‘category__in’ => array(12345),
‘showposts’ => 10,
‘caller_get_posts’ => 1
);
query_posts($args);

if (have_posts()) :
while (have_posts()) : the_post(); update_post_caches($posts); ?>
<li>* <a href=”<?php the_permalink(); ?>” rel=”bookmark” title=”<?php the_title_attribute(); ?>”><?php the_title(); ?></a></li>
<?php endwhile; else : ?>
<li>* 暂无文章</li>
<?php endif; wp_reset_query(); ?>
</ul>

备注:12345是分类id,10是信息数。

文章作者:大连seo
本文地址:http://www.dalianseo.com/483.html
版权所有 © 转载时必须以链接形式注明作者和原始出处!

认真发表评论,获取外链[本站已开启dofollow]

  1. #1 骤雨打新荷 回复 | 引用 Post:2011-08-08 19:34

    俺是大连的,偶然发现大连的wordpress,亲切哈!

  2. #2 大连seo 回复 | 引用 Post:2011-08-17 09:34

    自己顶一下,测试。

发表评论