Listingslab Productions
The Problem
You have a client who you are creating a WordPress website for. The client doesn't want her website to be viewable until they're happy with it, and asks you to put a holding page up while they get their copy etc finalized.
Trouble is. Once you replace that index.php page with a holding page, they can't view the site to work on it.
The Solution
Add a little bit of functionality to the wordpress system which allows logged in users to view the site, whilst sending all other users to the holding page.
Step By Step
-
Step 1: Create a holding page
Create a new file called holding.php. This will be your simple holding page. Add your client's logo, a little text and a link to http://www.yoursite.com/wp-admin withe the text 'Owner Login' or something similar. Upload this page to your server.
-
Step 2: Create a conditional redirect for logged in users
We're looking for the point in the WordPress system where we can identify a user and also use PHP's header( 'Location feature before any other headers are sent (which would create an error.
Open wp-blog-header.php. This is the point. After the wp-load.php file has loaded and the function wp(); has run, we can use the get_currentuserinfo() function to tell what user_level is present.
Here we set up our condition, redirecting users who are not logged in to our holding page.
Edit your wp-blog-header.php file so it looks something like this & upload it to your server.
Test it thoroughly, but it should work!


