Displaying friend’s posts only

Not sure if you’re still looking for an answer to this as it’s been 7+ months since it was asked, but I was looking to accomplish the same thing and using the function you highlighted above, I came up with the code below that, when placed inside of the loop, works perfectly.

First, declare your global $current_user if you haven’t already:

<?php global $current_user; wp_get_current_user(); ?>

And then after you create your $args for pulling posts with whatever criteria are necessary, inside of the loop, wrap your output for posts in the simple if check:

<?php while (have_posts()) : the_post();
// declaring $post_author on each post to check if the post's author is friends with the current user, and if so, displays the post. 
$post_author = get_the_author_meta( 'ID' );
$current_user_friends = friends_check_status($current_user->ID, $post_author);

if($current_user_friends):
?>

// ... all of your HTML and PHP calls to post fields here

<?php endif; 
endwhile; ?>

This hides any posts where the current user is not friends with the post author. The only downside to this is that it’s not checking BEFORE posts are pulled, so if you’re expecting to have 10 posts displayed but the user isn’t friends with the 10 posts pulled, they’ll see 0. Definitely need to come up with a way to run the check BEFORE the array of posts is created for output to ensure that users are getting as many posts to be displayed as possible…