【发布时间】:2012-02-17 02:29:07
【问题描述】:
我已经为 wordpress 问题苦苦挣扎了几个星期,但我就是想不通。
我创建了一个名为“cpt_used”的自定义帖子类型,在该自定义帖子类型中我创建了一个名为“tax_used”的自定义分类,它是一个类别列表
我需要做的是显示属于每个自定义分类的所有帖子,我就是想不通。
我目前的代码如下,每个类别中有多个帖子,但它没有显示任何内容
$args = array(
'orderby' => 'name',
'hide_empty' => 0,
'taxonomy' => 'tax_used'
);
$categories = get_categories($args);
foreach( $categories as $category ) {
$newargs = array(
'category_name' => $category->slug,
'taxonomy' => 'tax_used',
'term' => 'cpt_used'
);
query_posts( $newargs );
if (have_posts()) :
while (have_posts()) : the_post();
the_title();
endwhile;
endif;
}
【问题讨论】:
标签: wordpress