我试图通过分类术语获得相关帖子。因此,标记为“伦敦”的帖子会将相关帖子标记为伦敦。如果帖子只被标记为一个分类术语,那么我的代码就可以工作了——在本例中是一个位置(entry\\u Location是分类)。但如果我将其标记为多个(如伦敦和巴黎),则不会返回任何结果。如何使其接受多个税务条款并显示两者的结果?
这就是我目前所拥有的。它只适用于标记了一个税项的帖子。
<?php
$this_post = $post->ID;
$query = new WP_Query(array(
\'post_type\' => \'dir_entry\',
\'posts_per_page\' => 10,
\'orderby\' => \'date\',
\'order\' => \'DESC\',
\'post__not_in\' => array($this_post),
\'entry_location\' => get_the_term_list( $post->ID, \'entry_location\' ))
);
while ($query->have_posts()) : $query->the_post();
?>
<li class="large-6 columns">
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
</li>
<?php endwhile; wp_reset_query(); ?>
谢谢你的建议。