我会尝试以下方法(未测试)
<?php
$friends = get_users( array( \'role\' => \'friends\' ) );
$friend_ids = array();
foreach( $friends as $friend )
$friend_ids[] = $friend->ID;
$news = new WP_Query( array( \'author\' => implode( \',\', $friend_ids ), \'post_type\' => \'news\', \'paged\' => get_query_var(\'paged\') ) );
?>
注意:“friends”是角色ID,而不是好名字。然后按正常方式使用循环:
<?php if ( $news->have_posts() ) : while ( $news->have_posts() ) : $news->the_post(); ?>
...
<?php endwhile; endif; ?>
<?php wp_reset_postdata(); ?>
希望这能奏效:)