我再wordpress 自定义的post type中想要获取当前文章的分类。分类也是自己用register_taxonomy
来自定义的。
<div class="cell-home">
<?php query_posts(array( 'post_type' => 'wcp_employees' ));?>
<?php if ( have_posts() ) : ?>
<?php query_posts(array( 'post_type' => 'wcp_employees' )); ?>
<?php while ( have_posts() ) : the_post(); ?>
<dl>
<dt style="background-image:url(<?php bloginfo('stylesheet_directory'); ?>/images/employees/01.jpg);">
<div class="title"><?php the_category(', '); ?></div>
</dt>
<dd style="display:block;">
<div class="txt-content">
<h3><?php the_title(); ?></h3>
<p><img class="thumb" src="<?php bloginfo('stylesheet_directory'); ?>/images/employees/04.jpg"></p>
<p><?=get_post_excerpt()?></p>
<p class="tr"><a href="<?php the_permalink(); ?>" class="btn-more">More</a></p>
</div>
</dd>
</dl>
<?php ;endwhile; twentyfourteen_paging_nav();?>
<?php else : ?>
<?php endif; ?>
</div>
这里我也用了query_posts
来指定自己的分类,但是分类还是现实不出来。
找到方法了,用这个function