1

我正在尝试制作一个索引页面,但只显示特定自定义类型的帖子。

循环是这样开始的:

 <?php while ( have_posts() ) : the_post() ?>

如何修改代码以显示来自名为“分类”的自定义类型的帖子?

谢谢!

4

1 回答 1

1

您最好创建自己的查询,并完全绕过帖子类型检查;

query_posts('post_type=my_post_type');
while (have_posts()):
    ...
endwhile;
于 2010-06-25T09:26:58.040 回答