Maintenance mode excluding site administrators

Only administrators already login will have access to the website, no one else. just change the $url variable to your url where you have the maintenance page desired.

function wp_maintenance_mode() {
if (!current_user_can('administrator')) {
   $url = "your maintenance file url you want to display while is on maintenance";
   wp_redirect( $url );
   exit;
}
add_action('get_header', 'wp_maintenance_mode');

if you just want to display a message just remove the redirect and echo something

function wp_maintenance_mode() {
   if (!current_user_can('administrator')) {
      wp_die('<h1>Under Maintenance</h1><br />Website under planned maintenance. Please check back later.');
   }
}
add_action('get_header', 'wp_maintenance_mode');