我有一个关于如何根据WordPress和BBpress标签显示相关主题的问题。我目前能够显示最新的主题,但与文章无关。
<div class="bbp-related">
<?php
$topics_post = array('author'=> 0, 'post_type'=>bbp_get_topic_post_type(), 'post_parent'=>$parent_forum, 'posts_per_page'=>3, 'post_status'=>join(',', array(bbp_get_public_status_id(), bbp_get_closed_status_id())), 'show_stickes'=>false, 'meta_key'=>'_bbp_last_active_time', 'orderby'=>'meta_value', 'order'=>'DESC', 'meta_query'=>array(bbp_exclude_forum_ids('meta_query')));
?>
<?php $widget_query = new WP_Query($topics_post); ?>
<?php while ($widget_query->have_posts()) :
$widget_query->the_post();
$topic_id = bbp_get_topic_id($widget_query->post->ID);
?>
<li>
<?php bbp_author_link( array( 'post_id' => 1, 'size' => 100 ) ); ?>
<a class="bbp-title" href="<?php bbp_topic_permalink($topic_id); ?>" title="<?php bbp_topic_title($topic_id); ?>"><?php bbp_topic_title($topic_id); ?></a>
<p><?php bbp_topic_excerpt($topic_id); ?></p>
<span class="reply"><?php bbp_forum_reply_count(); ?> Balasan</span>
<span class="reply-date"><?php bbp_reply_post_date(0, true); ?></span>
</li>
<?php endwhile; ?>
</div>
以上代码目前显示3个最新主题。我想要的是显示基于标签或类别的相关主题。我怎样才能做到这一点?感谢