Last active
August 29, 2015 14:11
-
-
Save dmcclintock/c7c8f733952aa5a20efe to your computer and use it in GitHub Desktop.
Quick Maintenance Mode snippet for WordPress theme
This file contains hidden or 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 | |
/* | |
* @author: Daniel McClintock | |
* @created: 12/2014 | |
* | |
* NOTES: | |
* Add the following snippet directly after the opening <body> tag | |
* in your 'header.php' file. | |
*/ | |
?> | |
<!-- ============== MAINTENANCE MODE =============== --> | |
<?php if ( !current_user_can('update_core') ) { ?> | |
<div style="width: 80%; text-align: center; color: #f1f1f1; padding: 10%; margin: 0 auto;"> | |
<h1>Welcome to <?php echo esc_attr(get_bloginfo('name', 'display')); ?></h1> | |
<h4><em>Site is currently undergoing maintenance; please return later!</em></h4> | |
</div> | |
<?php wp_footer(); ?> | |
</body> | |
</html> | |
<?php die; }?> | |
<!-- ALTERNATE METHOD: --> | |
<?php | |
/* | |
if ( !current_user_can('update_core') ) { | |
echo '<div style="width: 80%; text-align: center; color: #f1f1f1; padding: 10%; margin: 0 auto;">'; | |
echo '<h1>Welcome to ' . esc_attr(get_bloginfo('name', 'display')) .'</h1>'; | |
echo '<h4><em>Site is currently undergoing maintenance; please return later!</em></h4>'; | |
echo '</div>'; | |
wp_footer(); | |
echo '</body>'; | |
echo '</html>'; | |
die; } | |
*/ | |
?> | |
<!-- // ============== END MAINTENANCE MODE =============== --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment