0
我有一个自定义帖子类型称为recipe
和自定义分类标准为cuisine
和recipe_type
。显示自定义帖子类型分类术语旁边帖子在Wordpress
我要显示的页面与分类的相关术语10个食谱清单属于:
我有下面的代码显示了食谱,但不是分类术语:
<?php
query_posts(array(
'post_type' => 'recipe',
'showposts' => 10
));
?>
<?php while (have_posts()) : the_post(); ?>
<li>
<?php the_title(); ?>
<?php $terms = wp_get_post_terms($query->post->ID, array('cuisine', 'recipe_type')); ?>
<?php foreach ($terms as $term) : ?>
<p><?php echo $term->taxonomy; ?>: <?php echo $term->name; ?></p>
<?php endforeach; ?>
</li>
<?php endwhile;?>
的分类项是'$查询 - > POS t-> ID'甚至可以带回任何东西?我不认为这是基于您粘贴的代码的有效变量。无论哪种方式,逐步调试将非常有用。 – Nic