Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions newspack-nelson/sass/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@
}

// Site Content - not applied when sticky header is active
body:not(.h-stk) .site-content,
body:not(.h-stk).hide-page-title .site-content,
body:not(.h-stk).newspack-front-page.hide-homepage-title .site-content,
body:not(.h-stk):not(.newspack-front-page)
body:not(.h-stk, .splash-page-home, .page-template-no-header-footer) .site-content,
body:not(.h-stk, .splash-page-home, .page-template-no-header-footer).hide-page-title .site-content,
body:not(.h-stk, .splash-page-home, .page-template-no-header-footer).newspack-front-page.hide-homepage-title .site-content,
body:not(.h-stk, .splash-page-home, .page-template-no-header-footer):not(.newspack-front-page)
.newspack_global_ad.global_below_header + .site-content,
body:not(.h-stk) .site-breadcrumb {
@include utilities.media( tablet ) {
Expand Down Expand Up @@ -204,6 +204,15 @@ body:not(.h-sb) .site-header {
}
}

// No header, no footer
.page-template-no-header-footer,
.newspack-front-page.splash-page-home {
#primary {
border-top: 0;
padding: 0;
}
}

.single-featured-image-behind,
.single-featured-image-above {
#primary {
Expand Down Expand Up @@ -677,7 +686,7 @@ blockquote {
// Ads

.newspack_global_ad.global_below_header {
display: none;
display: none !important; // !important to override inline styles for this ad placement.
}

// Sponsors
Expand Down
13 changes: 11 additions & 2 deletions newspack-theme/front-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
* @package Newspack
*/

get_header();
$is_splash_page = get_theme_mod( 'splash_page_home', false );
if ( true === $is_splash_page ) {
get_template_part( 'template-parts/header/no-header', 'header' );
} else {
get_header();
}
?>
<section id="primary" class="content-area">
<main id="main" class="site-main">
Expand Down Expand Up @@ -38,4 +43,8 @@
</section><!-- #primary -->

<?php
get_footer();
if ( true === $is_splash_page ) {
get_template_part( 'template-parts/footer/no-footer', 'footer' );
} else {
get_footer();
}
22 changes: 22 additions & 0 deletions newspack-theme/inc/customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,28 @@ function newspack_customize_register( $wp_customize ) {
)
);

// Turn the homepage into a 'splash' page: no header and no footer.
$wp_customize->add_setting(
'splash_page_home',
array(
'default' => false,
'type' => 'theme_mod',
'sanitize_callback' => 'newspack_sanitize_checkbox',
)
);

$wp_customize->add_control(
'splash_page_home',
array(
'label' => esc_html__( 'Make the homepage a splash page', 'newspack-theme' ),
'description' => esc_html__( 'Hide the header and footer on the homepage so it can be a splash page or placeholder for a site under development.', 'newspack-theme' ),
'section' => 'static_front_page',
'priority' => 10,
'type' => 'checkbox',
'settings' => 'splash_page_home',
)
);

// Add option to upload logo specifically for the footer.
$wp_customize->add_setting(
'newspack_footer_logo',
Expand Down
7 changes: 7 additions & 0 deletions newspack-theme/inc/template-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ function newspack_body_classes( $classes ) {
$classes[] = 'hide-homepage-title';
}

// Make the homepage a splash page.
$splash_page_home = get_theme_mod( 'splash_page_home', false );
if ( true === $splash_page_home && is_front_page() ) {
$classes[] = 'splash-page-home';
}

// Hide specific page title.
$page_id = get_queried_object_id();
$page_hide_title = get_post_meta( $page_id, 'newspack_hide_page_title', true );
Expand Down Expand Up @@ -393,6 +399,7 @@ function newspack_get_avatar_size() {
return 60;
}


/**
* Returns true if comment is by author of the post.
*
Expand Down
32 changes: 5 additions & 27 deletions newspack-theme/no-header-footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,8 @@
* @package Newspack
*/

?><!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="profile" href="https://gmpg.org/xfn/11" />
<?php wp_head(); ?>
</head>

<body <?php body_class(); ?> data-amp-auto-lightbox-disable>
<?php do_action( 'wp_body_open' ); ?>

<div id="page" class="site">
<a class="skip-link screen-reader-text" href="#main"><?php _e( 'Skip to content', 'newspack-theme' ); ?></a>

<div id="content" class="site-content">

get_template_part( 'template-parts/header/no-header', 'header' );
?>
<section id="primary" class="content-area">
<main id="main" class="site-main">
<?php
Expand All @@ -36,7 +21,7 @@
if ( in_array( newspack_featured_image_position(), array( 'large', 'behind', 'beside', 'above' ) ) ) :
get_template_part( 'template-parts/post/large-featured-image' );
else :
?>
?>
<header class="entry-header">
<?php get_template_part( 'template-parts/header/entry', 'header' ); ?>
</header>
Expand All @@ -63,12 +48,5 @@

</main><!-- #main -->
</section><!-- #primary -->

</div><!-- #content -->

</div><!-- #page -->

<?php wp_footer(); ?>

</body>
</html>
<?php
get_template_part( 'template-parts/footer/no-footer', 'footer' );
17 changes: 12 additions & 5 deletions newspack-theme/sass/blocks/_blocks.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1246,11 +1246,18 @@ hr {
}

// Remove space between full-width group block and header on homepage.
.newspack-front-page.hide-homepage-title .entry-content > .wp-block-group.alignfull:first-child,
.newspack-front-page.hide-homepage-title [id="pico"] > .wp-block-group.alignfull:first-child {
margin-top: 0;
@include utilities.media( tablet ) {
margin-top: calc(#{-0.5 * structure.$size__spacing-unit} - 1px); // minus 1px to offset bottom border on header
.newspack-front-page.hide-homepage-title {
.entry-content > .wp-block-group.alignfull:first-child,
[id="pico"] > .wp-block-group.alignfull:first-child {
margin-top: 0;

@include utilities.media( tablet ) {
margin-top: calc(#{-0.5 * structure.$size__spacing-unit} - 1px); // minus 1px to offset bottom border on header
}
}

&.splash-page-home .entry .entry-content > *.alignfull:first-child {
margin-top: 0;
}
}

Expand Down
4 changes: 4 additions & 0 deletions newspack-theme/sass/site/primary/_posts-and-pages.scss
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,10 @@ div.sharedaddy {
.entry-footer {
margin-bottom: 0;
}

&.splash-page-home .site-content {
margin-top: 0;
}
}

/* Author description */
Expand Down
16 changes: 16 additions & 0 deletions newspack-theme/template-parts/footer/no-footer-footer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
/**
* Replaces the footer.php for the No Header or Footer template, and the Homepage splash page option.
*
* Contains the closing of the #content div and all content after.
*
* @package Newspack
*/
?>
</div><!-- #content -->
</div><!-- #page -->

<?php wp_footer(); ?>

</body>
</html>
24 changes: 24 additions & 0 deletions newspack-theme/template-parts/header/no-header-header.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* Replaces the header.php for the No Header or Footer template, and the Homepage splash page option.
*
* This is the template that displays all of the <head> section and everything up until <div id="content">
*
* @package Newspack
*/
?><!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="profile" href="https://gmpg.org/xfn/11" />
<?php wp_head(); ?>
</head>

<body <?php body_class(); ?> data-amp-auto-lightbox-disable>
<?php do_action( 'wp_body_open' ); ?>

<div id="page" class="site">
<a class="skip-link screen-reader-text" href="#main"><?php _e( 'Skip to content', 'newspack-theme' ); ?></a>

<div id="content" class="site-content">