Skip to content

Instantly share code, notes, and snippets.

@sanusart
Last active November 3, 2018 17:25
Show Gist options
  • Save sanusart/8921679 to your computer and use it in GitHub Desktop.
Save sanusart/8921679 to your computer and use it in GitHub Desktop.
Wordpress temp page for not logged-in users #wordpress
<?php
// functions.php
function temp_mode() {
if ( ! current_user_can( 'edit_themes' ) || ! is_user_logged_in() ) {
echo '<!DOCTYPE html>
<html>
<head>
<title>coming soon</title>
<link href="http://fonts.googleapis.com/css?family=Roboto:400,100,900" rel="stylesheet" type="text/css">
<style type="text/css">
body {
font-family: "Roboto", sans-serif;
}
.center {
margin:90px auto 0;
text-align: center;
}
h1 {
font-weight: 100;
font-size:46px;
text-transform:uppercase;
}
p {
font-size:17px;
text-transform:uppercase;
}
</style>
</head>
<body>
<div class="center">
<h1>WELCOME TO <strong>domainname.com</strong></h1>
<p>Website is coming soon</p>
<br /><br /><br />
<h2>:)</h2>
</div>
</body>
</html>';
exit();
}
}
add_action('get_header', 'temp_mode'); // Comment out to disable
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment