Skip to content

Commit

Permalink
Drastically simplify the Offline page
Browse files Browse the repository at this point in the history
  • Loading branch information
ryelle committed Jan 17, 2020
1 parent ac3e6c8 commit 3755ab3
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@
*/
function inject_offline_template( $template_path ) {
if ( function_exists( 'is_offline' ) && ( \is_offline() || \is_500() ) ) {
if ( 'twentytwenty' === get_template() ) {
$template_path = __DIR__ . '/templates/offline-2020.php';
} else {
$template_path = __DIR__ . '/templates/offline.php';
}
$template_path = __DIR__ . '/templates/offline.php';
}

return $template_path;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,68 @@

namespace WordCamp\Theme_Templates;

get_header();

$offline_page = get_offline_content();
?>
$site_description = get_bloginfo( 'description' );
?><!DOCTYPE html>

<?php echo 'twentyseventeen' === get_template() ? '<div class="wrap">' : ''; ?>
<html class="no-js" <?php language_attributes(); ?>>

<main id="main" class="site-main">
<section class="error-offline">
<header class="page-header">
<h1 class="page-title">
<?php echo wp_kses_post( $offline_page['title'] ); ?>
</h1>
</header>
<head>

<div class="page-content">
<?php echo wp_kses_post( $offline_page['content'] ); ?>
</div>
</section>
</main>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0" >

<?php echo 'twentyseventeen' === get_template() ? '</div>' : ''; ?>
<link rel="profile" href="https://gmpg.org/xfn/11">

<?php
<?php wp_head(); ?>
<style>
.offline-container {
margin: 5vh auto;
padding: 2em;
max-width: 46em;
}
.theme-twentyfourteen .offline-container {
padding-top: 1px; /* Prevents margin collapse. */
background: white;
}
.theme-twentyfifteen:before { /* Remove the sidebar background– there is no sidebar. */
display: none;
}
.theme-twentyfifteen .offline-container,
.theme-twentysixteen .offline-container {
background: white;
}
.theme-twentytwenty section {
padding-top: 0;
}
</style>

</head>

<body <?php body_class( array( 'theme-' . get_template(), 'page-offline' ) ); ?>>
<div class="offline-container">
<header>
<h1>
<?php echo esc_html( get_bloginfo( 'name' ) ); ?>
</h1>
<?php if ( $site_description ) : ?>
<p><?php echo esc_html( $site_description ); ?></p>
<?php endif; ?>
</header>
<main>
<section>
<header>
<h2>
<?php echo wp_kses_post( $offline_page['title'] ); ?>
</h2>
</header>

get_footer();
<div>
<?php echo wp_kses_post( $offline_page['content'] ); ?>
</div>
</section>
</main>
</div>
<?php wp_footer(); ?>
</body>
</html>

0 comments on commit 3755ab3

Please sign in to comment.