Skip to content

Instantly share code, notes, and snippets.

@alaanasssar
Last active October 13, 2017 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alaanasssar/a48e5f467fc80e6c05fc7a9b1b238200 to your computer and use it in GitHub Desktop.
Save alaanasssar/a48e5f467fc80e6c05fc7a9b1b238200 to your computer and use it in GitHub Desktop.
Custom Maintenance page for WordPress.
<?php
/* Upload this file to the root of your wp-content folder.
* Domain : maintenance
*
* For style the page - Don't forget to remove this comment.
*
* function _e( $text, $domain = 'default' ) {
* echo $text ;
* }
* function get_bloginfo($name){
* echo 'website title';
* }
*/
header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Status: 503 Service Temporarily Unavailable');
header('Retry-After: 600');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title><?php get_bloginfo('name') ?></title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<style>
body {
text-align: center;
padding: 10%;
min-height: 100vh;
}
h1 {
margin-bottom: 5%;
}
h2 {
margin-bottom: 2.5%;
}
</style>
</head>
<body>
<h1><?php _e("Maintenance Mode" , "maintenance") ?></h1>
<h2><?php _e("We are currently performing some quick updates." , "maintenance")?></h2>
<p><?php _e("The page will refresh after " , "maintenance")?>
<span id="demo"></span>.
</p>
<script>
var seconds = 60;
window.setInterval(function(){
seconds = seconds - 1;
document.getElementById("demo").innerHTML = seconds + "<?php _e('s','maintenance'); ?> ";
if (seconds === 0) {
document.getElementById("demo").remove();
location.reload();
}
}, 1000);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment