Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter dntel

    (@dntel)

    Hi @dimned,

    I’ve changed it, however I get the same result. Does the plugin require the wp header or so? It looks like it doesn’t show the p class=”notification error” on the maintenance page.

    The shortcode and the ‘Another Mailchimp widget’ appears to be working when placed in theme itself.

    • This reply was modified 4 years, 4 months ago by dntel.
    Thread Starter dntel

    (@dntel)

    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, 4 months ago by dntel.
    Thread Starter dntel

    (@dntel)

    Which update?

Viewing 3 replies - 1 through 3 (of 3 total)