【发布时间】:2014-04-29 03:39:16
【问题描述】:
我正在创建一个新模板,它将获取所有自定义帖子类型(案例研究)内容,包括与之关联的分类值。
到目前为止,我得到了以下信息:
<section>
<h1><?php _e( 'posts', 'casestudies' ); ?></h1>
<?php get_template_part('loop'); ?>
<?php
$args = array('post_type' => 'casestudies', 'posts_per_page' => 3);
$query = new WP_Query($args);
while($query -> have_posts()) : $query -> the_post();
?>
<h2><?php the_title(); ?></h2>
<p>Meta: <?php the_meta(); ?></p>
<p>Excerpt: <?php the_excerpt(); ?></p>
<p>what_to_put_here_to_get_taxonomies_values????</p>
<?php endwhile; ?>
<?php get_template_part('pagination'); ?>
</section>
我如何获得它的分类?我尝试了多种方法,但似乎都失败了,而且变得更加困惑。
【问题讨论】:
-
我的最终代码如下所示: 'casestudies', 'posts_per_page' => 3); $query = new WP_Query($args); while($query -> have_posts()) : $query -> the_post(); ?>
元:
摘录:
post->ID, array( 'sectors', 'region', 'equipment' ) ); ?>taxonomy; ?>: name; ?>
标签: php wordpress custom-post-type custom-taxonomy