Only Show Posts if User is Logged In

You want to show stuff only if the user is logged in, without having to check off ‘Private’ status while writing every post.

This example checks if the user is logged in. It displays the login form if the user is not logged in. Place your entire loop (beginning and ending) in between line 7 and line 11 to only show posts to users who are logged in.

<?php if (!is_user_logged_in() ) {

 echo '<blockquote class="isa_warning">You must log in to view this. Please log in now.</blockquote>';
//get login form
wp_login_form();
      } 
else { 

// do loop or something

} //end if not logged in
?>

Questions and Comments are Welcome

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this:

[code]

YOUR CODE HERE 

[/code]