Created
March 5, 2015 16:26
-
-
Save datamafia/5e5773b858a1c208f3b8 to your computer and use it in GitHub Desktop.
Wordpress development script for previews
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 | |
/* | |
Install this in your theme header.php as the first statement | |
(next line right after the <?php opening tag) | |
Change $magic_word to what ever variable you want to use, | |
default is "preview" | |
To use this, go to yoursite.com?preview and a session will | |
be created and access to the site will last as long as the | |
session endures. Use yoursite.com?preview to refresh the session. | |
Session length varies. 1-6 hour minimum is common. | |
When you want to kick it live, just delete these lines. | |
*/ | |
// Dev preview | |
$magic_word = 'preview'; | |
session_start(); | |
if (isset($_GET[$magic_word])){ | |
$_SESSION['preview'] = True; | |
} | |
if (!$_SESSION['preview']){ | |
exit(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment