Testing

Is is possible to test out WordPress before going live? Having to read Build Your own Wicked WordPress Theme is not a very helpful book. I wanted to test it with Flux 3 a similar application like Dreamweaver but for the mac only.

You can set up a testing environment on your Mac with MAMP. Very handy for this sort of thing.

For testing purposes, using your own local server as suggested is the best bet, but if you have a site up already and wanted a quick and dirty way to put it into “development mode” I would adjust the main index.php file (the one in the main root directory of your WP install):

$arrIPs = array(
	'12.34.456.78', // Allowed IPs here
	'87.654.32.21');

if(!in_array($_SERVER['REMOTE_ADDR'], $arrIPs)){
	require('index.html'); // This can be a placeholder page everyone else sees
	die(); 	
}else{
	//This loads the WP environment for the people behind the allowed IPs
	define('WP_USE_THEMES', true);	
	require('./wp-blog-header.php');
}

If you were theorectially doing work for a client, I would go the more secure route of restricting access via the .htaccess file – the above is just a clunky way of solving it. Obviously if your IP changes then this method as is doesn’t work very well. You could use regex to target a certain range of IPs, but at that point I wouldn’t waste my time and just use .htaccess restrictions.