Last active
August 29, 2015 14:01
-
-
Save hiranthi/101deda4b83ce2684838 to your computer and use it in GitHub Desktop.
Put Shopp in maintenance mode, without kicking loggedin users out too.
This file contains 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 | |
new HiddenShopp; | |
class HiddenShopp | |
{ | |
/** | |
* Construct everything | |
* | |
* @author Hiranthi Molhoek-Herlaar | |
* @since 1.0 | |
**/ | |
public function __construct() | |
{ | |
add_filter( 'search_template', array( &$this, 'maintenance' ) ); | |
add_filter( 'taxonomy_template', array( &$this, 'maintenance' ) ); | |
add_filter( 'page_template', array( &$this, 'maintenance' ) ); | |
add_filter( 'single_template', array( &$this, 'maintenance' ) ); | |
} // end __construct | |
/** | |
* Get into maintenance mode, or not when the visitor is logged in | |
* | |
* @author Hiranthi Molhoek-Herlaar | |
* @since 1.0 | |
**/ | |
public function maintenance( $template ) | |
{ | |
if ( ! is_user_logged_in() ) | |
{ | |
// Build the page | |
$Page = new ShoppMaintenancePage(); | |
$Page->poststub(); | |
// Send the template back to WordPress | |
return locate_template( $Page->templates() ); | |
} | |
return $template; | |
} // end maintenance | |
} // end class | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment