Skip to content

Commit

Permalink
Merge pull request #523 from Automattic/build/offline-template
Browse files Browse the repository at this point in the history
PWA: Add 'offline.php' template
  • Loading branch information
laurelfulford authored Oct 24, 2019
2 parents 4197b12 + 48f8181 commit f961fce
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion header.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@

<?php
// If logo is not centered.
if ( false === $header_center_logo ) {
if ( false === $header_center_logo && has_nav_menu( 'primary-menu' ) ) {
get_template_part( 'template-parts/header/header', 'search' );
}
?>
Expand Down
35 changes: 35 additions & 0 deletions offline.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* The PWA Offline template file
*
* @package Newspack
*/

// Prevent showing nav menus.
add_filter( 'has_nav_menu', '__return_false' );

// Prevent showing widgets.
add_filter( 'is_active_sidebar', '__return_false' );

// Disable WordAds in the header.
// See: https://wordads.co/2018/02/07/how-to-control-jetpack-ad-placements-using-hooks/
add_filter( 'wordads_header_disable', '__return_true' );

get_header();
?>
<section id="primary" class="content-area">
<header class="entry-header">
<h1 class="entry-title"><?php esc_html_e( 'Offline', 'newspack' ); ?></h1>
</header><!-- .entry-header -->
<main id="main" class="site-main">
<?php
if ( function_exists( 'wp_service_worker_error_message_placeholder' ) ) {
wp_service_worker_error_message_placeholder();
}
?>
</main><!-- .site-main -->
</section><!-- .content-area -->
<?php
get_footer();


1 change: 1 addition & 0 deletions sass/layout/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
}

.site-content {
min-height: 30vh;
overflow: hidden;
}

Expand Down

0 comments on commit f961fce

Please sign in to comment.