private static function loadTemplate($array)
    {
        global $wp_styles, $wp_scripts;
        if (!$array || !is_array($array) || count($array) === 0) {
            return;
        }

        if (self::checkTemplatePresence($array[0])) {
            $isadmin = is_admin_bar_showing();
            add_filter('show_admin_bar', '__return_false');
            self::$renderer->render($array[0], []);
            @$wp_styles->done = array();
            @$wp_scripts->done = array(); 
            if ($isadmin) {
                add_filter('show_admin_bar', '__return_true');
            }
            $template = self::$renderer->render($array[0], self::$data);
            
            
            
            $template = str_replace("<html>", "<html " . get_language_attributes() . ">", $template);
            $template = str_replace("<body>", '<body class="' . implode(" ", get_body_class()) . '">', $template);

            echo $template;

            if (!is_admin()) {
                $wp_styles->done = array();
                $wp_scripts->done = array();
            }
        } else {
            self::loadTemplate(array_slice($array, 1));
        }
    }