Reputation: 141
In WordPress with BuddyPress, how can I display for a user posts (custom post type) that are created by his friends only?
Not as/in activity steam (it's disabled on the site), but as usual loop while(have_posts()):
.
Thank you in advance.
Upvotes: 0
Views: 301
Reputation: 1956
Try:
$friend_ids = friends_get_friend_user_ids( bp_loggedin_user_id() );
if ( ! empty( $friend_ids ) {
$args = array(
'author__in' => $friend_ids
);
$query = new WP_Query( $args );
}
Adjust $args
to include other parameters like post_type
. And then create a while
loop.
Upvotes: 1