If you want to hide any page if user is not logged in. To do this you can use this simple example.
<?php /* Template Name: Only for logged in users */ if ( !is_user_logged_in()) { get_template_part('not-logged-in'); exit(0); } get_header(); ?>
the file that’s called might be something like this:
<!DOCTYPE HTML> <html> <head> <title>Oooops...! You need to login.</title> </head> <body> <h1>To view this page you need to login.</h1> </body> </html>