好的,这是我的设置:
称为“问题”的自定义帖子类型(对于杂志)具有与相应问题的帖子ID匹配的自定义元字段的帖子。
当我在一个“问题”帖子页面上时,我想查询所有相关的帖子,并按其关联的类别显示它们。我的post查询工作正常,我似乎无法理解类别分组。
这是我的问题
<?php
global $post;
// List posts by the terms for a custom taxonomy of any post type
$current = get_the_ID($post->ID);
$args = array(
\'post_type\' => \'post\',
\'post_status\' => \'publish\',
\'posts_per_page\' => -1,
\'orderby\' => \'title\',
\'meta_key\' => \'_rkv_issue_select\',
\'meta_value\' => $current
);
$issue_cats = new WP_Query($args);
if( $issue_cats->have_posts() ) :
?>
<ul>
<?php while ( $issue_cats->have_posts() ) : $issue_cats->the_post(); ?>
<li><?php the_title(); ?></li>
<?php endwhile; // end of loop ?>
<?php else : ?>
<?php endif; // if have_posts() ?>
</ul>
<?php wp_reset_query(); ?>