Skip to content

Instantly share code, notes, and snippets.

@hiranthi
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiranthi/101deda4b83ce2684838 to your computer and use it in GitHub Desktop.
Save hiranthi/101deda4b83ce2684838 to your computer and use it in GitHub Desktop.
Put Shopp in maintenance mode, without kicking loggedin users out too.
<?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