浏览代码

refactor FSE header templates

Ben Dwyer 4 年之前
父节点
当前提交
1e4cb5f7bd

+ 4 - 20
balasana/template-parts/header/header-content.php

@@ -1,20 +1,4 @@
-<?php 
-if ( ( true === get_theme_mod( 'hide_site_header', false ) && is_front_page() && is_page() ) ) : return; // Return if this is the homepage and the hide-header setting is active. ?>
-
-<?php elseif ( class_exists( 'A8C\FSE\WP_Template' ) ) : // If not, check if the FSE plugin is active, use the Header template for content. ?>
-
-	<header id="masthead" class="site-header responsive-max-width">
-		<?php
-			$template = new A8C\FSE\WP_Template();
-			$template->output_template_content( A8C\FSE\WP_Template::HEADER );
-		?>
-	</header>
-
-<?php else : // Otherwise we'll fallback to the default Balasana header below. ?>
-
-	<header id="masthead" class="site-header responsive-max-width">
-		<?php get_template_part( 'template-parts/header/site', 'branding' ); ?>
-		<?php get_template_part( 'template-parts/header/site', 'navigation' ); ?>
-	</header><!-- #masthead -->
-
-<?php endif; ?>
+<header id="masthead" class="site-header responsive-max-width">
+	<?php get_template_part( 'template-parts/header/site', 'branding' ); ?>
+	<?php get_template_part( 'template-parts/header/site', 'navigation' ); ?>
+</header><!-- #masthead -->

+ 0 - 16
coutoire/template-parts/header/header-content.php

@@ -1,17 +1,3 @@
-<?php 
-if ( ( true === get_theme_mod( 'hide_site_header', false ) && is_front_page() && is_page() ) ) : return; // Return if this is the homepage and the hide-header setting is active. ?>
-
-<?php elseif ( class_exists( 'A8C\FSE\WP_Template' ) ) : // If not, check if the FSE plugin is active, use the Header template for content. ?>
-
-	<header id="masthead" class="fse-template-part fse-header entry-content">
-		<?php
-			$template = new A8C\FSE\WP_Template();
-			$template->output_template_content( A8C\FSE\WP_Template::HEADER );
-		?>
-	</header>
-
-<?php else : // Otherwise we'll fallback to the default Varia header below. ?>
-
 <header id="masthead" class="site-header alignfull">
 
 	<?php get_template_part( 'template-parts/header/site', 'branding' ); ?>
@@ -41,5 +27,3 @@ if ( ( true === get_theme_mod( 'hide_site_header', false ) && is_front_page() &&
 	<?php get_template_part( 'template-parts/header/social', 'navigation' ); ?>
 
 </header><!-- #masthead -->
-
-<?php endif; ?>

+ 2 - 19
dalston/template-parts/header/header-content.php

@@ -1,30 +1,13 @@
-<?php 
-
+<?php
 $has_primary_nav = has_nav_menu( 'menu-1' );
 $header_classes  = 'site-header';
 $header_classes .= has_custom_logo() ? ' has-logo' : '';
 $header_classes .= 1 === get_theme_mod( 'header_text', 1 ) ? ' has-title-and-tagline' : '';
 $header_classes .= $has_primary_nav ? ' has-menu' : '';
-
-if ( ( true === get_theme_mod( 'hide_site_header', false ) && is_front_page() && is_page() ) ) : return; // Return if this is the homepage and the hide-header setting is active. ?>
-
-<?php elseif ( class_exists( 'A8C\FSE\WP_Template' ) ) : // If not, check if the FSE plugin is active, use the Header template for content. ?>
-	
-<header id="masthead" class="site-header site-branding entry-content">
-	<?php
-		$template = new A8C\FSE\WP_Template();
-		$template->output_template_content( A8C\FSE\WP_Template::HEADER );
-	?>
-</header>
-
-<?php else : // Otherwise we'll fallback to the default Varia header below. ?>
+?>
 
 <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/site', 'navigation' ); ?>
 	<?php get_template_part( 'template-parts/header/social', 'navigation' ); ?>
-
 </header><!-- #masthead -->
-
-<?php endif; ?>

+ 10 - 25
morden/template-parts/header/header-content.php

@@ -1,30 +1,15 @@
-<?php 
+<?php
 $has_primary_nav = has_nav_menu( 'menu-1' );
 $header_classes  = 'site-header-wrap responsive-max-width';
 $header_classes .= has_custom_logo() ? ' has-logo' : '';
 $header_classes .= 1 === get_theme_mod( 'header_text', 1 ) ? ' has-title-and-tagline' : '';
 $header_classes .= $has_primary_nav ? ' has-menu' : '';
-
-if ( ( true === get_theme_mod( 'hide_site_header', false ) && is_front_page() && is_page() ) ) : return; // Return if this is the homepage and the hide-header setting is active. ?>
-
-<?php elseif ( class_exists( 'A8C\FSE\WP_Template' ) ) : // If not, check if the FSE plugin is active, use the Header template for content. ?>
-
-	<header id="masthead" class="fse-template-part fse-header entry-content">
-		<?php
-			$template = new A8C\FSE\WP_Template();
-			$template->output_template_content( A8C\FSE\WP_Template::HEADER );
-		?>
-	</header>
-
-<?php else : // Otherwise we'll fallback to the default Varia header below. ?>
-
-	<header id="masthead" class="site-header" role="banner">
-		<div class="<?php echo $header_classes; ?>">
-			<?php get_template_part( 'template-parts/header/site', 'branding' ); ?>
-			<?php get_template_part( 'template-parts/header/site', 'navigation' ); ?>
-			<?php get_template_part( 'template-parts/header/social', 'navigation' ); ?>
-		</div><!-- .site-header-wrap -->
-
-	</header><!-- #masthead -->
-
-<?php endif; ?>
+?>
+
+<header id="masthead" class="site-header" role="banner">
+	<div class="<?php echo $header_classes; ?>">
+		<?php get_template_part( 'template-parts/header/site', 'branding' ); ?>
+		<?php get_template_part( 'template-parts/header/site', 'navigation' ); ?>
+		<?php get_template_part( 'template-parts/header/social', 'navigation' ); ?>
+	</div><!-- .site-header-wrap -->
+</header><!-- #masthead -->

+ 6 - 21
rivington/template-parts/header/header-content.php

@@ -1,27 +1,12 @@
-<?php 
-
+<?php
 $has_primary_nav = has_nav_menu( 'menu-1' );
 $header_classes  = 'site-header responsive-max-width';
 $header_classes .= has_custom_logo() ? ' has-logo' : '';
 $header_classes .= 1 === get_theme_mod( 'header_text', 1 ) ? ' has-title-and-tagline' : '';
 $header_classes .= $has_primary_nav ? ' has-menu' : '';
+?>
 
-if ( ( true === get_theme_mod( 'hide_site_header', false ) && is_front_page() && is_page() ) ) : return; // Return if this is the homepage and the hide-header setting is active. ?>
-
-<?php elseif ( class_exists( 'A8C\FSE\WP_Template' ) ) : // If not, check if the FSE plugin is active, use the Header template for content. ?>
-
-	<header id="masthead" class="fse-template-part fse-header entry-content">
-		<?php
-			$template = new A8C\FSE\WP_Template();
-			$template->output_template_content( A8C\FSE\WP_Template::HEADER );
-		?>
-	</header>
-
-<?php else : // Otherwise we'll fallback to the default Varia header below. ?>
-
-	<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/site', 'navigation' ); ?>
-	</header><!-- #masthead -->
-
-<?php endif; ?>
+<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/site', 'navigation' ); ?>
+</header><!-- #masthead -->

+ 4 - 20
rockfield/template-parts/header/header-content.php

@@ -1,20 +1,4 @@
-<?php 
-if ( ( true === get_theme_mod( 'hide_site_header', false ) && is_front_page() && is_page() ) ) : return; // Return if this is the homepage and the hide-header setting is active. ?>
-
-<?php elseif ( class_exists( 'A8C\FSE\WP_Template' ) ) : // If not, check if the FSE plugin is active, use the Header template for content. ?>
-
-	<header id="masthead" class="fse-template-part fse-header entry-content">
-		<?php
-			$template = new A8C\FSE\WP_Template();
-			$template->output_template_content( A8C\FSE\WP_Template::HEADER );
-		?>
-	</header>
-
-<?php else : // Otherwise we'll fallback to the default Varia header below. ?>
-
-	<header id="masthead" class="site-header">
-		<?php get_template_part( 'template-parts/header/site', 'branding' ); ?>
-		<?php get_template_part( 'template-parts/header/site', 'navigation' ); ?>
-	</header><!-- #masthead -->
-
-<?php endif; ?>
+<header id="masthead" class="site-header">
+	<?php get_template_part( 'template-parts/header/site', 'branding' ); ?>
+	<?php get_template_part( 'template-parts/header/site', 'navigation' ); ?>
+</header><!-- #masthead -->

+ 2 - 1
spearhead/variables.css

@@ -51,6 +51,7 @@
 
 	--entry-header--font-size: var(--heading--font-size-h1);
 	--entry-header--color: var(--global--color-foreground);
+	--entry-header--color-link: var(--entry-header--color);
 
 	--button--border-radius: 0px;
 	--button--color-text: var(--global--color-background);
@@ -102,7 +103,7 @@
 }
 
 @media ( prefers-color-scheme: dark ) {
-	:root {
+	:root :not(.custom-colors) {
 		--global--color-primary: #ff6a81;
 		--global--color-primary-hover: #ffffff;
 		--global--color-secondary: #b2b2b2;

+ 4 - 21
stow/template-parts/header/header-content.php

@@ -1,21 +1,4 @@
-<?php 
-
-if ( ( true === get_theme_mod( 'hide_site_header', false ) && is_front_page() && is_page() ) ) : return; // Return if this is the homepage and the hide-header setting is active. ?>
-
-<?php elseif ( class_exists( 'A8C\FSE\WP_Template' ) ) : // If not, check if the FSE plugin is active, use the Header template for content. ?>
-
-	<header id="masthead" class="fse-template-part fse-header entry-content">
-		<?php
-			$template = new A8C\FSE\WP_Template();
-			$template->output_template_content( A8C\FSE\WP_Template::HEADER );
-		?>
-	</header>
-
-<?php else : // Otherwise we'll fallback to the default Varia header below. ?>
-
-	<header id="masthead" class="site-header">
-		<?php get_template_part( 'template-parts/header/site', 'branding' ); ?>
-		<?php get_template_part( 'template-parts/header/site', 'navigation' ); ?>
-	</header><!-- #masthead -->
-
-<?php endif; ?>
+<header id="masthead" class="site-header">
+	<?php get_template_part( 'template-parts/header/site', 'branding' ); ?>
+	<?php get_template_part( 'template-parts/header/site', 'navigation' ); ?>
+</header><!-- #masthead -->

+ 6 - 22
stratford/template-parts/header/header-content.php

@@ -1,26 +1,10 @@
-<?php 
-if ( ( true === get_theme_mod( 'hide_site_header', false ) && is_front_page() && is_page() ) ) : return; // Return if this is the homepage and the hide-header setting is active. ?>
+<header id="masthead" class="site-header alignfull">
 
-<?php elseif ( class_exists( 'A8C\FSE\WP_Template' ) ) : // If not, check if the FSE plugin is active, use the Header template for content. ?>
+	<div class="site-header-wrapper">
 
-	<header id="masthead" class="fse-template-part fse-header entry-content">
-		<?php
-			$template = new A8C\FSE\WP_Template();
-			$template->output_template_content( A8C\FSE\WP_Template::HEADER );
-		?>
-	</header>
+		<?php get_template_part( 'template-parts/header/site', 'branding' ); ?>
+		<?php get_template_part( 'template-parts/header/site', 'navigation' ); ?>
 
-<?php else : // Otherwise we'll fallback to the default Varia header below. ?>
+	</div>
 
-	<header id="masthead" class="site-header alignfull">
-			
-		<div class="site-header-wrapper">
-			
-			<?php get_template_part( 'template-parts/header/site', 'branding' ); ?>
-			<?php get_template_part( 'template-parts/header/site', 'navigation' ); ?>
-			
-		</div>
-
-	</header><!-- #masthead -->
-
-<?php endif; ?>
+</header><!-- #masthead -->

+ 9 - 1
varia/header.php

@@ -30,6 +30,14 @@ if ( function_exists( 'wp_body_open' ) ) {
 <div id="page" class="site">
 	<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'varia' ); ?></a>
 
-	<?php get_template_part( 'template-parts/header/header', 'content' ); ?>
+	<?php
+	if ( ( true === get_theme_mod( 'hide_site_header', false ) && is_front_page() && is_page() ) ) {
+		// Do nothing if this is the homepage and the hide-header setting is active.
+	} elseif ( class_exists( 'A8C\FSE\WP_Template' ) ) { // If not, check if the FSE plugin is active, use the Header template for content.
+		get_template_part( 'template-parts/header/fse', 'header' );
+	} else { // Otherwise we'll fallback to the default Varia header below.
+		get_template_part( 'template-parts/header/header', 'content' );
+	}
+	?>
 
 	<div id="content" class="site-content">

+ 12 - 27
varia/template-parts/header/header-content.php

@@ -1,27 +1,12 @@
-<?php 
-
-$has_primary_nav       = has_nav_menu( 'menu-1' );
-$header_classes        = 'site-header responsive-max-width';
-$header_classes       .= has_custom_logo() ? ' has-logo' : '';
-$header_classes       .= 1 === get_theme_mod( 'header_text', 1 ) ? ' has-title-and-tagline' : '';
-$header_classes       .= $has_primary_nav ? ' has-menu' : '';
-
-if ( ( true === get_theme_mod( 'hide_site_header', false ) && is_front_page() && is_page() ) ) : return; // Return if this is the homepage and the hide-header setting is active. ?>
-
-<?php elseif ( class_exists( 'A8C\FSE\WP_Template' ) ) : // If not, check if the FSE plugin is active, use the Header template for content. ?>
-
-	<header id="masthead" class="fse-template-part fse-header entry-content">
-		<?php
-			$template = new A8C\FSE\WP_Template();
-			$template->output_template_content( A8C\FSE\WP_Template::HEADER );
-		?>
-	</header>
-
-<?php else : // Otherwise we'll fallback to the default Varia header below. ?>
-
-	<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/site', 'navigation' ); ?>
-	</header><!-- #masthead -->
-
-<?php endif; ?>
+<?php
+$has_primary_nav = has_nav_menu( 'menu-1' );
+$header_classes  = 'site-header responsive-max-width';
+$header_classes .= has_custom_logo() ? ' has-logo' : '';
+$header_classes .= 1 === get_theme_mod( 'header_text', 1 ) ? ' has-title-and-tagline' : '';
+$header_classes .= $has_primary_nav ? ' has-menu' : '';
+?>
+
+<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/site', 'navigation' ); ?>
+</header><!-- #masthead -->