Display Private Posts to Logged-in Users

<?php if (have_posts()) : while (have_posts()) : the_post();
$private = get_post_custom_values(“private”);
if (isset($private[0]) && $private == “true”) {
if (is_user_logged_in()) {
// Display private post to logged user
}
} else {
// Display public post to everyone
}
endwhile; endif; ?>


Private Posts