tcmulder / aquamin

Aquamin WordPress Theme
3 stars 1 forks source link

Consider adding aquamin_admin_lockout() function. #57

Closed tcmulder closed 11 months ago

tcmulder commented 11 months ago

This could be something like:

define( 'AQUAMIN_ADMIN_LOCKOUT', true );
add_action( 'admin_init', function() {
    if( AQUAMIN_ADMIN_LOCKOUT && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
        header( 'location:  http://www.thinkaquamarine.com/maintenance.html' );
        // or use this to redirect internally: wp_safe_redirect( home_url( '/maint.html' ) );
        exit;
    }
} );

Would probably want to go with the safe_redirect version and an internal link (maybe housed in the includes folder) so others can use this theme. I'd want to add this as the very first thing in the functions.php so it's easy to find.

Or, I could include a file includes/maint/maint.php in functions.php. I could add the constant to the functions.php constants, so all I need to do is toggle it true/false and the files are abstracted away into a separate folder.

tcmulder commented 11 months ago

I think this would be better as a gist or something, so as not to bloat the theme for others who may never use it.