【发布时间】:2015-06-25 11:46:57
【问题描述】:
我正在尝试分别获取当前的自定义分类链接和名称以放置一些架构数据,我的代码是:
<?php $args = array('taxonomy' => 'developer'); ?>
<?php $tax_menu_items = get_categories( $args );
foreach ( $tax_menu_items as $tax_menu_item ):?>
<meta itemprop="url" content="<?php echo get_term_link($tax_menu_item,$tax_menu_item->taxonomy); ?>"></meta>
<a href="<?php echo get_term_link($tax_menu_item,$tax_menu_item->taxonomy); ?>">
<span itemprop="name"><?php echo $tax_menu_item->name; ?></span></a>
<?php endforeach; ?>
</div>`
问题是上面的代码显示了所有至少有一个帖子的“开发者”,而不是当前的帖子分类。
我该如何解决这个问题!
【问题讨论】:
-
我终于自己解决了这个问题!
标签: taxonomy custom-taxonomy custom-tags