我有一个名为“classe”的自定义帖子类型。我正在尝试遍历这些帖子,以获得它们的分类法和术语列表。这是我的代码:
$type = \'classe\';
$args = array(
\'post_type\' => $type,
\'post_status\' => \'publish\',
\'posts_per_page\' => -1,
\'ignore_sticky_posts\'=> true
);
$loop = null;
$loop = new WP_Query($args);
if( $loop->have_posts() ):
while ($loop->have_posts()) : $loop->the_post();
$taxonomies = ???? //Get taxonomies
$result = \'<div class="col-xs-12 col-md-4">\';
$result .= \'<div class="grid-content">\';
$result .= \'<h2>\' . get_the_title() .\'</h2>\';
$result .= \'<p>\' . get_the_excerpt() .\'</p>\';
foreach($taxonomies as $taxonomy){
$terms = ???? //Get terms
$result .= \'<h4>\' . $taxonomy . \'</h4>\';
foreach($terms as $term){
$result .= \'<p>\' . $term . \'</p>\';
}
}
$result .= \'</div>\';
$result .= \'</div>\';
echo $result;
endwhile;
endif;
wp_reset_query();