您可以使用$post->post_author
,
所以在循环添加之前$agent = \'\';
然后在循环内添加
$agent = $post->post_author;
然后在循环结束后创建第二个查询:
$agent_query = NEW WP_Query(array(\'post_type\' => \'agent\', \'author\' => $agent));
while ($agent_query->have_posts()){
$agent_query->the_post();
//do your agent loop here
}
wp_reset_postdata();