【发布时间】:2012-09-03 17:18:01
【问题描述】:
在其他地方看过很多帖子,但没有什么能达到目标。
我需要回应与自定义帖子类型相关的自定义分类的特定术语的描述。
现在,我正在成功执行以下循环,以便为每个术语的相关自定义帖子提取内容(在这种情况下,我的自定义帖子类型是“rental_gear”,我的术语是“相机”:
<? $args = array(
'post_type'=> 'rental_gear',
'type' => 'cameras',
'order' => 'ASC'
);
$the_query = new WP_Query( $args );
if($the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post();
?>
<li><a href="<? the_permalink(); ?>">› <? the_title(); ?></a></li>
<?php endwhile; endif; wp_reset_postdata(); ?>
我可以在这个循环中提取术语的描述吗? 我尝试了“get_term”功能并拉动“$term->description;”但这些与帖子有关,这是在概述页面上列出了许多帖子的信息(因此使用了循环)
【问题讨论】:
标签: wordpress custom-post-type custom-taxonomy taxonomy-terms