Lance Grover

Lance Grover

So you play with wordpress and you want to see it but you want others to see an underconstruction page?

Posted date:


Here is a fun little modification you can make to the wordpress index.php so that only you can see the wordpress instance and everyone else will see an underconstruction image.  Keep in mind, this requires you to be connecting to your website from a static IP, or just update the file every time your IP changes….that works too.

<?php
/**
* Front to the WordPress application. This file doesn’t do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/

/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
$ip=$_SERVER[‘REMOTE_ADDR’];
if ($ip == ‘222.222.222.222’ || $ip == ‘111.111.111.111) {
/* Just replace 222.222.222.222 and 111.111.111.111 with your own ip addresses and anyone connecting to your wordpress instance from those IP addresses would see the wordpress site, everyone else would see a basic html page that just displays an image – you will need to supply the image – called underconstruction.jpg.  – or call it what you like. */

define(‘WP_USE_THEMES’, true);

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . ‘/wp-blog-header.php’ );
}
else
{
?>

<html>
<body>
<center><img src=underconstruction.jpg></center>
</body>
</html>

<?php
}
?>