Hi Dmytro,
No problem! I’ve created my own maintenance plugin and registered a widget area. With the following code:
add_action( 'wp_loaded', function()
{
global $pagenow;
// - - - - - - - - - - - - - - - - - - - - - -
// Turn on/off you Maintenance Mode (true/false)
define('IN_MAINTENANCE', true);
// - - - - - - - - - - - - - - - - - - - - - -
if(
defined( 'IN_MAINTENANCE' )
&& IN_MAINTENANCE
&& $pagenow !== 'wp-login.php'
&& ! is_user_logged_in()
) {
header('HTTP/1.1 503 Service Unavailable');
header( 'Content-Type: text/html; charset=utf-8' );
if ( file_exists( WP_CONTENT_DIR . '/plugins/maintenance_mode/index.php' ) ) {
require_once( WP_CONTENT_DIR . '/plugins/maintenance_mode/index.php' );
}
die();
}
});
// WIDGET AREA
function maintenance_widget_area() {
register_sidebar(
array(
'id' => 'maintenance-widget',
'name' => esc_html__( 'Maintenance', 'theme-domain' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<div class="widget-title-holder"><h3 class="widget-title">',
'after_title' => '</h3></div>'
)
);
}
add_action( 'widgets_init', 'maintenance_widget_area' );
In my maintenance template (index.php) I’ve used the widget hook. It’s visible in the wordpress dasboard under the widget area.
<div id="widget"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("maintenance-widget") ) : ?>
<?php endif;?></div>
-
This reply was modified 4 years, 1 month ago by dntel.