Last active
October 13, 2017 13:04
-
-
Save alaanasssar/a48e5f467fc80e6c05fc7a9b1b238200 to your computer and use it in GitHub Desktop.
Custom Maintenance page for WordPress.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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