Uname: Linux premium72.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software: LiteSpeed
PHP version: 8.2.29 [ PHP INFO ] PHP os: Linux
Server Ip: 198.54.125.95
Your Ip: 216.73.216.164
User: matican (532) | Group: matican (531)
Safe Mode: OFF
Disable Function:
NONE

name : maintenance.php
<?php 
	/*	
	*	Goodlayers Maintenance File
	*	---------------------------------------------------------------------
	*	This file contains the script that handles the maintenance mode
	*	---------------------------------------------------------------------
	*/

	// modify front page query
	add_action('pre_get_posts', 'logisco_maintenance_query');
	if( !function_exists('logisco_maintenance_query') ){
		function logisco_maintenance_query( $query ){

			if( !$query->is_main_query() ) return $query; 

			global $pagenow;

			$maintenance = logisco_get_option('plugin', 'enable-maintenance', 'disable');
			if( $maintenance == 'disable' || is_user_logged_in() || $pagenow == 'wp-login.php' || is_admin() ) return;

			// if at front page
			if( is_home() || (get_option('show_on_front') == 'page' && $query->get('page_id') == get_option('page_on_front')) ){
				$maintenance_page = logisco_get_option('plugin', 'maintenance-page', '');
				
				if( !empty($maintenance_page) ){
					
					$query->set('page_id', $maintenance_page);
					$query->set('post_type', 'page');
					$query->is_home = 0;
					$query->is_page = 1;
					$query->is_singular = 1;

					add_filter('template_include', 'logisco_maintenance_template', 99999);
				}
			}else{
				wp_redirect(home_url('/'));
				exit;
			}

			return $query;
		}
	}

	// set maintenance page template
	if( !function_exists('logisco_maintenance_template') ){
		function logisco_maintenance_template( $template ){
			return get_page_template();
		}
	}
© 2025 XylotrechusZ