Browse Source

Merge pull request #2985 from Automattic/try/header-footer-hide-seedlet

Seedlet: Add hide site header/footer Customizer options for the homepage
Ben Dwyer 4 years ago
parent
commit
2173f6cb89

+ 0 - 43
blank-canvas/footer.php

@@ -1,43 +0,0 @@
-<?php
-/**
- * The template for displaying the footer
- *
- * Contains the closing of the #content div and all content after.
- *
- * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
- *
- * @package Blank Canvas
- * @since 1.0
- */
-
-?>
-
-	</div><!-- #content -->
-
-	<footer id="colophon" class="site-footer default-max-width" role="contentinfo" aria-label="<?php esc_attr_e( 'Footer', 'blank-canvas' ); ?>">
-
-		<div class="site-info">
-			<?php $blog_info = get_bloginfo( 'name' ); ?>
-			<?php if ( ! empty( $blog_info ) ) : ?>
-				<a class="site-name" href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a><span class="comma">,</span>
-			<?php endif; ?>
-			<a href="<?php echo esc_url( __( 'https://wordpress.org/', 'seedlet' ) ); ?>" class="imprint">
-				<?php
-				/* translators: %s: WordPress. */
-				printf( __( 'Proudly powered by %s.', 'seedlet' ), 'WordPress' );
-				?>
-			</a>
-			<?php
-			if ( function_exists( 'the_privacy_policy_link' ) ) {
-				the_privacy_policy_link( '', '<span role="separator" aria-hidden="true"></span>' );
-			}
-			?>
-		</div><!-- .site-info -->
-	</footer><!-- #colophon -->
-
-</div><!-- #page -->
-
-<?php wp_footer(); ?>
-
-</body>
-</html>

+ 6 - 0
blank-canvas/functions.php

@@ -115,6 +115,12 @@ function blank_canvas_remove_customizer_settings( $wp_customize ) {
 		$wp_customize->remove_control( 'jetpack_content_author_bio' );
 	}
 
+	// Remove Seedlet's header and footer hide options,
+	// since they're already hidden by default.
+	$wp_customize->remove_control( 'hide_site_header' );
+	$wp_customize->remove_control( 'hide_site_footer' );
+
+
 	// Add a Customizer message about the site title & tagline options.
 	$wp_customize->get_section( 'title_tagline' )->description = __( 'This theme is designed to hide the site logo, site title, and tagline on all single posts and pages.', 'blank-canvas' );
 }

+ 0 - 55
blank-canvas/header.php

@@ -1,55 +0,0 @@
-<?php
-/**
- * The header for our theme
- *
- * This is the template that displays all of the <head> section and everything up until <div id="content">
- *
- * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
- *
- * @package Blank Canvas
- * @since 1.0
- */
-$blog_info    = get_bloginfo( 'name' );
-$description  = get_bloginfo( 'description', 'display' );
-$show_title   = ( true === get_theme_mod( 'display_title_and_tagline', true ) );
-$header_class = $show_title ? 'site-title' : 'screen-reader-text';
-
-?><!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(); ?>>
-<?php wp_body_open(); ?>
-<div id="page" class="site">
-	<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'blank-canvas' ); ?></a>
-
-	<?php if ( ! is_singular() ) : ?>
-		<header id="masthead" class="<?php echo $header_classes; ?>" role="banner">
-			<?php if ( has_custom_logo() && $show_title ) : ?>
-				<div class="site-logo"><?php the_custom_logo(); ?></div>
-			<?php endif; ?>
-
-			<div class="site-branding">
-				<?php if ( ! empty( $blog_info ) && $show_title ) : ?>
-					<?php if ( is_front_page() && is_home() ) : ?>
-						<h1 class="<?php echo esc_attr( $header_class ); ?>"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php echo $blog_info; ?></a></h1>
-					<?php else : ?>
-						<p class="<?php echo esc_attr( $header_class ); ?>"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php echo $blog_info; ?></a></p>
-					<?php endif; ?>
-				<?php endif; ?>
-
-				<?php if ( ( $description || is_customize_preview() ) && $show_title ) : ?>
-					<p class="site-description">
-						<?php echo $description; ?>
-					</p>
-				<?php endif; ?>
-			</div><!-- .site-branding -->
-		</header><!-- #masthead -->
-	<?php endif; ?>
-
-	<div id="content" class="site-content">

+ 1 - 1
blank-canvas/inc/wpcom.php

@@ -13,4 +13,4 @@
 function blank_canvas_wpcom_customize_update( $wp_customize ) {
 	$wp_customize->remove_control( 'hide_front_page_title');
 }
-add_action( 'customize_register', 'blank_canvas_wpcom_customize_update', 11 );
+add_action( 'customize_register', 'blank_canvas_wpcom_customize_update', 11 );

+ 1 - 0
blank-canvas/template-parts/footer/footer-content.php

@@ -0,0 +1 @@
+<?php get_template_part( 'template-parts/footer/footer-info' );

+ 10 - 0
blank-canvas/template-parts/header/header-content.php

@@ -0,0 +1,10 @@
+<?php
+	$show_title   = ( true === get_theme_mod( 'display_title_and_tagline', true ) );
+	$header_class = $show_title ? 'site-title' : 'screen-reader-text';
+?>
+
+<?php if ( ! is_singular() ) : ?>
+	<header id="masthead" class="<?php echo $header_classes; ?>" role="banner">
+		<?php get_template_part( 'template-parts/header/site-branding' ); ?>
+	</header><!-- #masthead -->
+<?php endif; ?>

+ 16 - 0
seedlet/assets/css/style-editor.css

@@ -1663,6 +1663,18 @@ pre.wp-block-verse {
 	}
 }
 
+.home.page.hide-homepage-header.hide-homepage-title .entry-content {
+	margin-top: 0;
+	padding-top: 0;
+}
+
+.home.page.hide-homepage-header.hide-homepage-title .entry-content > .wp-block-image.alignfull:first-child,
+.home.page.hide-homepage-header.hide-homepage-title .entry-content > .wp-block-cover.alignfull:first-child,
+.home.page.hide-homepage-header.hide-homepage-title .entry-content > .wp-block-media-text.alignfull:first-child,
+.home.page.hide-homepage-header.hide-homepage-title .entry-content > .wp-block-group.has-background.alignfull:first-child {
+	margin-top: calc(-1 * var(--global--spacing-vertical));
+}
+
 .entry-attachment {
 	text-align: center;
 }
@@ -1742,6 +1754,10 @@ pre.wp-block-verse {
 	border-top: var(--separator--height) solid var(--separator--border-color);
 }
 
+.home.page.hide-homepage-footer .site-main > article > .entry-footer {
+	border-width: 0;
+}
+
 /**
  * Post Thumbnails
  */

+ 14 - 0
seedlet/assets/sass/components/entry/_content.scss

@@ -56,6 +56,20 @@
 	.wp-audio-shortcode {
 		@extend %responsive-aligndefault-width;
 	}
+
+	// If the homepage header and page title are both configured to be hidden.
+	.home.page.hide-homepage-header.hide-homepage-title & {
+		margin-top: 0;
+		padding-top: 0;
+
+		// Move some full-width blocks up to the top of the screen.
+		> .wp-block-image.alignfull:first-child,
+		> .wp-block-cover.alignfull:first-child,
+		> .wp-block-media-text.alignfull:first-child,
+		> .wp-block-group.has-background.alignfull:first-child {
+			margin-top: calc(-1 * var(--global--spacing-vertical));
+		}
+	}
 }
 
 .entry-attachment {

+ 5 - 0
seedlet/assets/sass/components/entry/_meta.scss

@@ -62,4 +62,9 @@
 	margin-top: calc( var(--global--spacing-vertical) * 3 );
 	padding-top: var(--global--spacing-unit);
 	border-top: var(--separator--height) solid var(--separator--border-color);
+
+	// Remove the border if the homepage's main footer is also hidden.
+	.home.page.hide-homepage-footer & {
+		border-width: 0;
+	}
 }

+ 1 - 34
seedlet/footer.php

@@ -15,40 +15,7 @@
 	</div><!-- #content -->
 
 	<footer id="colophon" class="site-footer default-max-width" role="contentinfo" aria-label="<?php esc_attr_e( 'Footer', 'seedlet' ); ?>">
-
-		<?php get_template_part( 'template-parts/footer/footer-widgets' ); ?>
-
-		<?php if ( has_nav_menu( 'footer' ) ) : ?>
-		<nav class="footer-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Footer Menu', 'seedlet' ); ?>">
-			<?php
-			wp_nav_menu(
-				array(
-					'theme_location' => 'footer',
-					'menu_class'     => 'footer-menu',
-					'depth'          => 1,
-				)
-			);
-			?>
-		</nav><!-- .footer-navigation -->
-		<?php endif; ?>
-
-		<div class="site-info">
-			<?php $blog_info = get_bloginfo( 'name' ); ?>
-			<?php if ( ! empty( $blog_info ) ) : ?>
-				<a class="site-name" href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a><span class="comma">,</span>
-			<?php endif; ?>
-			<a href="<?php echo esc_url( __( 'https://wordpress.org/', 'seedlet' ) ); ?>" class="imprint">
-				<?php
-				/* translators: %s: WordPress. */
-				printf( __( 'Proudly powered by %s.', 'seedlet' ), 'WordPress' );
-				?>
-			</a>
-			<?php
-			if ( function_exists( 'the_privacy_policy_link' ) ) {
-				the_privacy_policy_link( '', '<span role="separator" aria-hidden="true"></span>' );
-			}
-			?>
-		</div><!-- .site-info -->
+		<?php get_template_part( 'template-parts/footer/footer-content' ); ?>
 	</footer><!-- #colophon -->
 
 </div><!-- #page -->

+ 1 - 98
seedlet/header.php

@@ -9,11 +9,6 @@
  * @package Seedlet
  * @since 1.0.0
  */
-$has_primary_nav = has_nav_menu( 'primary' );
-$header_classes  = 'site-header header_classes';
-$header_classes .= has_custom_logo() ? ' has-logo' : '';
-$header_classes .= true === get_theme_mod( 'display_title_and_tagline', true ) ? ' has-title-and-tagline' : '';
-$header_classes .= $has_primary_nav ? ' has-menu' : '';
 ?><!doctype html>
 <html <?php language_attributes(); ?>>
 <head>
@@ -28,98 +23,6 @@ $header_classes .= $has_primary_nav ? ' has-menu' : '';
 <div id="page" class="site">
 	<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'seedlet' ); ?></a>
 
-		<header id="masthead" class="<?php echo $header_classes; ?>" role="banner">
-			<?php get_template_part( 'template-parts/header/site-branding' ); ?>
-
-			<?php if ( $has_primary_nav ) : ?>
-				<nav id="site-navigation" class="primary-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Main', 'seedlet' ); ?>">
-					<button id="primary-close-menu" class="button close">
-						<span class="dropdown-icon close"><?php _e( 'Close', 'seedlet' ); ?> <?php echo seedlet_get_icon_svg( 'close' ); ?></span>
-						<span class="hide-visually collapsed-text"><?php _e( 'collapsed', 'seedlet' ); ?></span>
-					</button>
-					<?php
-					// Get menu slug
-					$location_name = 'primary';
-					$locations     = get_nav_menu_locations();
-					$menu_id       = $locations[ $location_name ];
-					$menu_obj      = wp_get_nav_menu_object( $menu_id );
-
-					wp_nav_menu(
-						array(
-							'theme_location'  => 'primary',
-							'menu_class'      => 'menu-wrapper',
-							'container_class' => 'primary-menu-container',
-							'items_wrap'      => '<ul id="%1$s" class="%2$s">%3$s</ul>',
-						)
-					);
-					?>
-				</nav><!-- #site-navigation -->
-			<?php endif; ?>
-
-			<div class="menu-button-container">
-				<?php if ( $has_primary_nav ) : ?>
-					<button id="primary-open-menu" class="button open">
-						<span class="dropdown-icon open"><?php _e( 'Menu', 'seedlet' ); ?> <?php echo seedlet_get_icon_svg( 'menu' ); ?></span>
-						<span class="hide-visually expanded-text"><?php _e( 'expanded', 'seedlet' ); ?></span>
-					</button>
-				<?php endif; ?>
-			</div>
-
-			<?php if ( class_exists( 'WooCommerce' ) ) : ?>
-				<nav class="woo-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Woo Minicart', 'seedlet' ); ?>">
-					<?php
-					echo( sprintf(
-						'<button id="woo-close-menu" class="button close">
-							<span class="dropdown-icon close">%1$s %2$s</span>
-							<span class="hide-visually collapsed-text">%3$s</span>
-						</button>
-						<div class="woocommerce-menu-container">
-							<ul id="woocommerce-menu" class="menu-wrapper"">
-							<li class="menu-item woocommerce-menu-item %4$s" title="%5$s">
-								%6$s
-								<ul class="sub-menu">
-									<li class="woocommerce-cart-widget" title="%7$s">
-										%8$s
-									</li>
-								</ul>
-							</li>',
-						esc_html__( 'Close', 'seedlet' ),
-						seedlet_get_icon_svg( 'close' ),
-						esc_html__( 'collapsed', 'seedlet' ),
-						is_cart() ? 'current-menu-item' : '',
-						esc_attr__( 'View your shopping cart', 'seedlet' ),
-						seedlet_cart_link(),
-						esc_attr__( 'View your shopping list', 'seedlet' ),
-						seedlet_cart_widget()
-					) );
-					?>
-				</nav><!-- .woo-navigation -->
-			<?php endif; ?>
-
-			<div class="menu-button-container">
-				<?php if ( class_exists( 'WooCommerce' ) ) : ?>
-					<button id="woo-open-menu" class="button open">
-						<span class="dropdown-icon open"><?php echo seedlet_get_icon_svg( 'shopping_cart' ); ?> <?php _e( 'Cart', 'seedlet' ); ?></span>
-						<span class="hide-visually expanded-text"><?php esc_html__( 'expanded', 'seedlet' ); ?></span>
-					</button>
-				<?php endif; ?>
-			</div>
-
-			<?php if ( has_nav_menu( 'social' ) ) : ?>
-				<nav class="social-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Social Links Menu', 'seedlet' ); ?>">
-					<?php
-					wp_nav_menu(
-						array(
-							'theme_location' => 'social',
-							'link_before'    => '<span class="screen-reader-text">',
-							'link_after'     => '</span>' . seedlet_get_icon_svg( 'link' ),
-							'depth'          => 1,
-						)
-					);
-					?>
-				</nav><!-- .social-navigation -->
-			<?php endif; ?>
-
-		</header><!-- #masthead -->
+	<?php get_template_part( 'template-parts/header/header-content' ); ?>
 
 	<div id="content" class="site-content">

+ 36 - 0
seedlet/inc/customizer.php

@@ -138,6 +138,42 @@ if ( ! class_exists( 'Seedlet_Customize' ) ) {
 					'label'   => esc_html__( 'Display Site Title & Tagline', 'seedlet' ),
 				)
 			);
+
+			// Add setting to hide the site header on the homepage.
+			$wp_customize->add_setting( 'hide_site_header', array(
+				'default'              => false,
+				'type'                 => 'theme_mod',
+				'transport'            => 'refresh',
+				'sanitize_callback'    => array( __CLASS__, 'sanitize_checkbox' ),
+			) );
+
+			// Add control to hide the site header on the homepage.
+			$wp_customize->add_control( 'hide_site_header', array(
+				'label'		  => esc_html__( 'Hide the Site Header', 'seedlet' ),
+				'description' => esc_html__( 'Check to hide the site header, if your homepage is set to display a static page.', 'seedlet' ),
+				'section'	  => 'static_front_page',
+				'priority'	  => 10,
+				'type'		  => 'checkbox',
+				'settings'	  => 'hide_site_header',
+			) );
+
+			// Add setting to hide footer elements on the homepage.
+			$wp_customize->add_setting( 'hide_site_footer', array(
+				'default'              => false,
+				'type'                 => 'theme_mod',
+				'transport'            => 'refresh',
+				'sanitize_callback'    => array( __CLASS__, 'sanitize_checkbox' ),
+			) );
+
+			// Add control to hide footer elements on the homepage.
+			$wp_customize->add_control( 'hide_site_footer', array(
+				'label'		  => esc_html__( 'Hide the Site Footer Menu & Widgets', 'seedlet' ),
+				'description' => esc_html__( 'Check to hide the site menu & widgets in the footer, if your homepage is set to display a static page.', 'seedlet' ),
+				'section'	  => 'static_front_page',
+				'priority'	  => 10,
+				'type'		  => 'checkbox',
+				'settings'	  => 'hide_site_footer',
+			) );
 		}
 
 		/**

+ 14 - 0
seedlet/inc/template-functions.php

@@ -35,6 +35,20 @@ function seedlet_body_classes( $classes ) {
 		$classes[] = 'has-main-navigation';
 	}
 
+	// Add a body class if the site header is hidden on the homepage.
+	$hide_site_header = get_theme_mod( 'hide_site_header', false );
+
+	if ( true === $hide_site_header && is_front_page() ) {
+		$classes[] = 'hide-homepage-header';
+	}
+
+	// Add a body class if the footer elements are hidden on the homepage.
+	$hide_site_footer = get_theme_mod( 'hide_site_footer', false );
+
+	if ( true === $hide_site_footer && is_front_page() ) {
+		$classes[] = 'hide-homepage-footer';
+	}
+
 	return $classes;
 }
 add_filter( 'body_class', 'seedlet_body_classes' );

+ 16 - 0
seedlet/style-rtl.css

@@ -3192,6 +3192,18 @@ nav a {
 	}
 }
 
+.home.page.hide-homepage-header.hide-homepage-title .entry-content {
+	margin-top: 0;
+	padding-top: 0;
+}
+
+.home.page.hide-homepage-header.hide-homepage-title .entry-content > .wp-block-image.alignfull:first-child,
+.home.page.hide-homepage-header.hide-homepage-title .entry-content > .wp-block-cover.alignfull:first-child,
+.home.page.hide-homepage-header.hide-homepage-title .entry-content > .wp-block-media-text.alignfull:first-child,
+.home.page.hide-homepage-header.hide-homepage-title .entry-content > .wp-block-group.has-background.alignfull:first-child {
+	margin-top: calc(-1 * var(--global--spacing-vertical));
+}
+
 .entry-attachment {
 	text-align: center;
 }
@@ -3271,6 +3283,10 @@ nav a {
 	border-top: var(--separator--height) solid var(--separator--border-color);
 }
 
+.home.page.hide-homepage-footer .site-main > article > .entry-footer {
+	border-width: 0;
+}
+
 /**
  * Post Thumbnails
  */

+ 16 - 0
seedlet/style.css

@@ -3213,6 +3213,18 @@ nav a {
 	}
 }
 
+.home.page.hide-homepage-header.hide-homepage-title .entry-content {
+	margin-top: 0;
+	padding-top: 0;
+}
+
+.home.page.hide-homepage-header.hide-homepage-title .entry-content > .wp-block-image.alignfull:first-child,
+.home.page.hide-homepage-header.hide-homepage-title .entry-content > .wp-block-cover.alignfull:first-child,
+.home.page.hide-homepage-header.hide-homepage-title .entry-content > .wp-block-media-text.alignfull:first-child,
+.home.page.hide-homepage-header.hide-homepage-title .entry-content > .wp-block-group.has-background.alignfull:first-child {
+	margin-top: calc(-1 * var(--global--spacing-vertical));
+}
+
 .entry-attachment {
 	text-align: center;
 }
@@ -3292,6 +3304,10 @@ nav a {
 	border-top: var(--separator--height) solid var(--separator--border-color);
 }
 
+.home.page.hide-homepage-footer .site-main > article > .entry-footer {
+	border-width: 0;
+}
+
 /**
  * Post Thumbnails
  */

+ 7 - 0
seedlet/template-parts/footer/footer-content.php

@@ -0,0 +1,7 @@
+<?php if ( ! ( true === get_theme_mod( 'hide_site_footer', false ) && is_front_page() ) ) : ?>
+	<?php get_template_part( 'template-parts/footer/footer-widgets' ); ?>
+	<?php get_template_part( 'template-parts/footer/footer-menu' ); ?>
+<?php endif; ?>
+
+<?php
+get_template_part( 'template-parts/footer/footer-info' );

+ 17 - 0
seedlet/template-parts/footer/footer-info.php

@@ -0,0 +1,17 @@
+<div class="site-info">
+	<?php $blog_info = get_bloginfo( 'name' ); ?>
+	<?php if ( ! empty( $blog_info ) ) : ?>
+		<a class="site-name" href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a><span class="comma">,</span>
+	<?php endif; ?>
+	<a href="<?php echo esc_url( __( 'https://wordpress.org/', 'seedlet' ) ); ?>" class="imprint">
+		<?php
+		/* translators: %s: WordPress. */
+		printf( __( 'Proudly powered by %s.', 'seedlet' ), 'WordPress' );
+		?>
+	</a>
+	<?php
+	if ( function_exists( 'the_privacy_policy_link' ) ) {
+		the_privacy_policy_link( '', '<span role="separator" aria-hidden="true"></span>' );
+	}
+	?>
+</div><!-- .site-info -->

+ 13 - 0
seedlet/template-parts/footer/footer-menu.php

@@ -0,0 +1,13 @@
+<?php if ( has_nav_menu( 'footer' ) ) : ?>
+	<nav class="footer-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Footer Menu', 'seedlet' ); ?>">
+		<?php
+		wp_nav_menu(
+			array(
+				'theme_location' => 'footer',
+				'menu_class'     => 'footer-menu',
+				'depth'          => 1,
+			)
+		);
+		?>
+	</nav><!-- .footer-navigation -->
+<?php endif; ?>

+ 14 - 0
seedlet/template-parts/header/header-content.php

@@ -0,0 +1,14 @@
+<?php
+$has_primary_nav = has_nav_menu( 'primary' );
+$header_classes  = 'site-header header_classes';
+$header_classes .= has_custom_logo() ? ' has-logo' : '';
+$header_classes .= true === get_theme_mod( 'display_title_and_tagline', true ) ? ' has-title-and-tagline' : '';
+$header_classes .= $has_primary_nav ? ' has-menu' : '';
+?>
+
+<?php if ( ! ( true === get_theme_mod( 'hide_site_header', false ) && is_front_page() ) ) : ?>
+	<header id="masthead" class="<?php echo $header_classes; ?>" role="banner">
+		<?php get_template_part( 'template-parts/header/site-branding' ); ?>
+		<?php get_template_part( 'template-parts/header/navigation' ); ?>
+	</header><!-- #masthead -->
+<?php endif; ?>

+ 107 - 0
seedlet/template-parts/header/navigation.php

@@ -0,0 +1,107 @@
+<?php
+	$has_primary_nav       = has_nav_menu( 'primary' );
+	$has_primary_nav_items = wp_nav_menu(
+		array(
+			'theme_location' => 'primary',
+			'fallback_cb'    => false,
+			'echo'           => false,
+		)
+	);
+	$has_social_nav        = has_nav_menu( 'social' );
+	$has_social_nav_items  = wp_nav_menu(
+		array(
+			'theme_location' => 'social',
+			'fallback_cb'    => false,
+			'echo'           => false,
+		)
+	);
+
+	?>
+<?php if ( $has_primary_nav && $has_primary_nav_items ) : ?>
+	<nav id="site-navigation" class="primary-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Main', 'seedlet' ); ?>">
+		<button id="primary-close-menu" class="button close">
+			<span class="dropdown-icon close"><?php _e( 'Close', 'seedlet' ); ?> <?php echo seedlet_get_icon_svg( 'close' ); ?></span>
+			<span class="hide-visually collapsed-text"><?php _e( 'collapsed', 'seedlet' ); ?></span>
+		</button>
+		<?php
+		// Get menu slug
+		$location_name = 'primary';
+		$locations     = get_nav_menu_locations();
+		$menu_id       = $locations[ $location_name ];
+		$menu_obj      = wp_get_nav_menu_object( $menu_id );
+
+		wp_nav_menu(
+			array(
+				'theme_location'  => 'primary',
+				'menu_class'      => 'menu-wrapper',
+				'container_class' => 'primary-menu-container',
+				'items_wrap'      => '<ul id="%1$s" class="%2$s">%3$s</ul>',
+			)
+		);
+		?>
+	</nav><!-- #site-navigation -->
+<?php endif; ?>
+
+<div class="menu-button-container">
+	<?php if ( $has_primary_nav && $has_primary_nav_items ) : ?>
+		<button id="primary-open-menu" class="button open">
+			<span class="dropdown-icon open"><?php _e( 'Menu', 'seedlet' ); ?> <?php echo seedlet_get_icon_svg( 'menu' ); ?></span>
+			<span class="hide-visually expanded-text"><?php _e( 'expanded', 'seedlet' ); ?></span>
+		</button>
+	<?php endif; ?>
+</div>
+
+<?php if ( class_exists( 'WooCommerce' ) ) : ?>
+	<nav class="woo-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Woo Minicart', 'seedlet' ); ?>">
+		<?php
+		echo( sprintf(
+			'<button id="woo-close-menu" class="button close">
+				<span class="dropdown-icon close">%1$s %2$s</span>
+				<span class="hide-visually collapsed-text">%3$s</span>
+			</button>
+			<div class="woocommerce-menu-container">
+				<ul id="woocommerce-menu" class="menu-wrapper"">
+				<li class="menu-item woocommerce-menu-item %4$s" title="%5$s">
+					%6$s
+					<ul class="sub-menu">
+						<li class="woocommerce-cart-widget" title="%7$s">
+							%8$s
+						</li>
+					</ul>
+				</li>',
+			esc_html__( 'Close', 'seedlet' ),
+			seedlet_get_icon_svg( 'close' ),
+			esc_html__( 'collapsed', 'seedlet' ),
+			is_cart() ? 'current-menu-item' : '',
+			esc_attr__( 'View your shopping cart', 'seedlet' ),
+			seedlet_cart_link(),
+			esc_attr__( 'View your shopping list', 'seedlet' ),
+			seedlet_cart_widget()
+		) );
+		?>
+	</nav><!-- .woo-navigation -->
+<?php endif; ?>
+
+<div class="menu-button-container">
+	<?php if ( class_exists( 'WooCommerce' ) ) : ?>
+		<button id="woo-open-menu" class="button open">
+			<span class="dropdown-icon open"><?php echo seedlet_get_icon_svg( 'shopping_cart' ); ?> <?php _e( 'Cart', 'seedlet' ); ?></span>
+			<span class="hide-visually expanded-text"><?php esc_html__( 'expanded', 'seedlet' ); ?></span>
+		</button>
+	<?php endif; ?>
+</div>
+
+<?php if ( $has_social_nav && $has_social_nav_items ) : ?>
+	<nav class="social-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Social Links Menu', 'seedlet' ); ?>">
+		<?php
+		wp_nav_menu(
+			array(
+				'theme_location' => 'social',
+				'link_before'    => '<span class="screen-reader-text">',
+				'link_after'     => '</span>' . seedlet_get_icon_svg( 'link' ),
+				'depth'          => 1,
+			)
+		);
+		?>
+	</nav><!-- .social-navigation -->
+<?php endif; ?>

+ 0 - 125
spearhead/header.php

@@ -1,125 +0,0 @@
-<?php
-/**
- * The header for our theme
- *
- * This is the template that displays all of the <head> section and everything up until <div id="content">
- *
- * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
- *
- * @package Spearhead
- * @since 1.0.0
- */
-$has_primary_nav = has_nav_menu( 'primary' );
-$header_classes  = 'site-header header_classes';
-$header_classes .= has_custom_logo() ? ' has-logo' : '';
-$header_classes .= true === get_theme_mod( 'display_title_and_tagline', true ) ? ' has-title-and-tagline' : '';
-$header_classes .= $has_primary_nav ? ' has-menu' : '';
-?><!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(); ?>>
-<?php wp_body_open(); ?>
-<div id="page" class="site">
-	<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'spearhead' ); ?></a>
-
-		<header id="masthead" class="<?php echo $header_classes; ?>" role="banner">
-			<?php get_template_part( 'template-parts/header/site-branding' ); ?>
-
-			<?php if ( $has_primary_nav || has_nav_menu( 'social' ) ) : ?>
-				<nav id="site-navigation" class="primary-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Main', 'spearhead' ); ?>">
-					<button id="primary-close-menu" class="button close">
-						<span class="dropdown-icon close"><?php _e( 'Close', 'spearhead' ); ?> <?php echo seedlet_get_icon_svg( 'close' ); ?></span>
-						<span class="hide-visually collapsed-text"><?php _e( 'collapsed', 'spearhead' ); ?></span>
-					</button>
-					<div class="extra-navigation-wrapper">
-						<?php
-						if ( $has_primary_nav ) :
-							// Get menu slug
-							$location_name = 'primary';
-							$locations     = get_nav_menu_locations();
-							$menu_id       = $locations[ $location_name ];
-							$menu_obj      = wp_get_nav_menu_object( $menu_id );
-
-							wp_nav_menu(
-								array(
-									'theme_location'  => 'primary',
-									'menu_class'      => 'menu-wrapper',
-									'container_class' => 'primary-menu-container',
-									'items_wrap'      => '<ul id="%1$s" class="%2$s">%3$s</ul>',
-								)
-							);
-						endif;
-						if ( has_nav_menu( 'social' ) ) :
-							wp_nav_menu(
-								array(
-									'theme_location'  => 'social',
-									'link_before'     => '<span class="screen-reader-text">',
-									'link_after'      => '</span>' . seedlet_get_icon_svg( 'link' ),
-									'container_class' => 'social-navigation',
-									'depth'           => 1,
-								)
-							);
-						endif;
-						?>
-					</div><!-- .extra-navigation-wrapper -->
-				</nav><!-- #site-navigation -->
-			<?php endif; ?>
-
-			<div class="menu-button-container">
-				<?php if ( $has_primary_nav ) : ?>
-					<button id="primary-open-menu" class="button open">
-						<span class="dropdown-icon open"><?php _e( 'Menu', 'spearhead' ); ?> <?php echo seedlet_get_icon_svg( 'menu' ); ?></span>
-						<span class="hide-visually expanded-text"><?php _e( 'expanded', 'spearhead' ); ?></span>
-					</button>
-				<?php endif; ?>
-			</div>
-
-			<?php if ( class_exists( 'WooCommerce' ) ) : ?>
-				<nav class="woo-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Woo Minicart', 'spearhead' ); ?>">
-					<?php
-					echo( sprintf(
-						'<button id="woo-close-menu" class="button close">
-							<span class="dropdown-icon close">%1$s %2$s</span>
-							<span class="hide-visually collapsed-text">%3$s</span>
-						</button>
-						<div class="woocommerce-menu-container">
-							<ul id="woocommerce-menu" class="menu-wrapper"">
-							<li class="menu-item woocommerce-menu-item %4$s" title="%5$s">
-								%6$s
-								<ul class="sub-menu">
-									<li class="woocommerce-cart-widget" title="%7$s">
-										%8$s
-									</li>
-								</ul>
-							</li>',
-						esc_html__( 'Close', 'spearhead' ),
-						seedlet_get_icon_svg( 'close' ),
-						esc_html__( 'collapsed', 'spearhead' ),
-						is_cart() ? 'current-menu-item' : '',
-						esc_attr__( 'View your shopping cart', 'spearhead' ),
-						spearhead_cart_link(),
-						esc_attr__( 'View your shopping list', 'spearhead' ),
-						spearhead_cart_widget()
-					) );
-					?>
-				</nav><!-- .woo-navigation -->
-			<?php endif; ?>
-
-			<div class="menu-button-container">
-				<?php if ( class_exists( 'WooCommerce' ) ) : ?>
-					<button id="woo-open-menu" class="button open">
-						<span class="dropdown-icon open"><?php echo seedlet_get_icon_svg( 'shopping_cart' ); ?> <?php _e( 'Cart', 'spearhead' ); ?></span>
-						<span class="hide-visually expanded-text"><?php esc_html__( 'expanded', 'spearhead' ); ?></span>
-					</button>
-				<?php endif; ?>
-			</div>
-
-		</header><!-- #masthead -->
-
-	<div id="content" class="site-content">

+ 89 - 0
spearhead/template-parts/header/navigation.php

@@ -0,0 +1,89 @@
+<?php $has_primary_nav = has_nav_menu( 'primary' );
+	if ( $has_primary_nav || has_nav_menu( 'social' ) ) : ?>
+	<nav id="site-navigation" class="primary-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Main', 'spearhead' ); ?>">
+		<button id="primary-close-menu" class="button close">
+			<span class="dropdown-icon close"><?php _e( 'Close', 'spearhead' ); ?> <?php echo seedlet_get_icon_svg( 'close' ); ?></span>
+			<span class="hide-visually collapsed-text"><?php _e( 'collapsed', 'spearhead' ); ?></span>
+		</button>
+		<div class="extra-navigation-wrapper">
+			<?php
+			if ( $has_primary_nav ) :
+				// Get menu slug
+				$location_name = 'primary';
+				$locations     = get_nav_menu_locations();
+				$menu_id       = $locations[ $location_name ];
+				$menu_obj      = wp_get_nav_menu_object( $menu_id );
+
+				wp_nav_menu(
+					array(
+						'theme_location'  => 'primary',
+						'menu_class'      => 'menu-wrapper',
+						'container_class' => 'primary-menu-container',
+						'items_wrap'      => '<ul id="%1$s" class="%2$s">%3$s</ul>',
+					)
+				);
+			endif;
+			if ( has_nav_menu( 'social' ) ) :
+				wp_nav_menu(
+					array(
+						'theme_location'  => 'social',
+						'link_before'     => '<span class="screen-reader-text">',
+						'link_after'      => '</span>' . seedlet_get_icon_svg( 'link' ),
+						'container_class' => 'social-navigation',
+						'depth'           => 1,
+					)
+				);
+			endif;
+			?>
+		</div><!-- .extra-navigation-wrapper -->
+	</nav><!-- #site-navigation -->
+<?php endif; ?>
+
+<div class="menu-button-container">
+	<?php if ( $has_primary_nav ) : ?>
+		<button id="primary-open-menu" class="button open">
+			<span class="dropdown-icon open"><?php _e( 'Menu', 'spearhead' ); ?> <?php echo seedlet_get_icon_svg( 'menu' ); ?></span>
+			<span class="hide-visually expanded-text"><?php _e( 'expanded', 'spearhead' ); ?></span>
+		</button>
+	<?php endif; ?>
+</div>
+
+<?php if ( class_exists( 'WooCommerce' ) ) : ?>
+	<nav class="woo-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Woo Minicart', 'spearhead' ); ?>">
+		<?php
+		echo( sprintf(
+			'<button id="woo-close-menu" class="button close">
+				<span class="dropdown-icon close">%1$s %2$s</span>
+				<span class="hide-visually collapsed-text">%3$s</span>
+			</button>
+			<div class="woocommerce-menu-container">
+				<ul id="woocommerce-menu" class="menu-wrapper"">
+				<li class="menu-item woocommerce-menu-item %4$s" title="%5$s">
+					%6$s
+					<ul class="sub-menu">
+						<li class="woocommerce-cart-widget" title="%7$s">
+							%8$s
+						</li>
+					</ul>
+				</li>',
+			esc_html__( 'Close', 'spearhead' ),
+			seedlet_get_icon_svg( 'close' ),
+			esc_html__( 'collapsed', 'spearhead' ),
+			is_cart() ? 'current-menu-item' : '',
+			esc_attr__( 'View your shopping cart', 'spearhead' ),
+			spearhead_cart_link(),
+			esc_attr__( 'View your shopping list', 'spearhead' ),
+			spearhead_cart_widget()
+		) );
+		?>
+	</nav><!-- .woo-navigation -->
+<?php endif; ?>
+
+<div class="menu-button-container">
+	<?php if ( class_exists( 'WooCommerce' ) ) : ?>
+		<button id="woo-open-menu" class="button open">
+			<span class="dropdown-icon open"><?php echo seedlet_get_icon_svg( 'shopping_cart' ); ?> <?php _e( 'Cart', 'spearhead' ); ?></span>
+			<span class="hide-visually expanded-text"><?php esc_html__( 'expanded', 'spearhead' ); ?></span>
+		</button>
+	<?php endif; ?>
+</div>