Pārlūkot izejas kodu

header for Balasana

Maggie Cabrera 4 gadi atpakaļ
vecāks
revīzija
bbbac691da

+ 0 - 72
balasana/header.php

@@ -1,72 +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 WordPress
- * @subpackage Varia
- * @since 1.0.0
- */
-?><!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
-	if ( function_exists( 'wp_body_open' ) ) {
-		wp_body_open();
-	}
-?>
-	
-<div id="page" class="site">
-	<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'balasana' ); ?></a>
-
-	<?php if ( class_exists( 'A8C\FSE\WP_Template' ) ) : // 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 if ( has_nav_menu( 'menu-1' ) ) : ?>
-				<nav id="site-navigation" class="main-navigation" aria-label="<?php esc_attr_e( 'Main Navigation', 'balasana' ); ?>">
-					<input type="checkbox" role="button" aria-haspopup="true" id="toggle" class="hide-visually">
-					<label for="toggle" id="toggle-menu" class="button">
-						<?php _e( 'Menu', 'balasana' ); ?>
-						<span class="hide-visually expanded-text"><?php _e( 'expanded', 'balasana' ); ?></span>
-						<span class="hide-visually collapsed-text"><?php _e( 'collapsed', 'balasana' ); ?></span>
-					</label>
-					<?php
-					wp_nav_menu(
-						array(
-							'theme_location' => 'menu-1',
-							'menu_class'     => 'main-menu',
-							'items_wrap'     => '<ul id="%1$s" class="%2$s" aria-label="submenu">%3$s</ul>',
-						)
-					);
-					?>
-				</nav><!-- #site-navigation -->
-			<?php endif; ?>
-
-		</header><!-- #masthead -->
-
-	<?php endif; ?>
-
-	<div id="content" class="site-content">

+ 10 - 8
balasana/template-parts/footer/footer-content.php

@@ -4,17 +4,19 @@
 		$template = new A8C\FSE\WP_Template();
 		$template = new A8C\FSE\WP_Template();
 		$template->output_template_content( A8C\FSE\WP_Template::FOOTER );
 		$template->output_template_content( A8C\FSE\WP_Template::FOOTER );
 		else : // Otherwise we'll fallback to the default Balasana footer below.
 		else : // Otherwise we'll fallback to the default Balasana footer below.
-			get_template_part( 'template-parts/footer/footer', 'widgets' );
 
 
-			if ( has_nav_menu( 'menu-2' ) || has_nav_menu( 'social' ) ) : ?>
-				<div class="footer-menus">
+			if ( ! ( true === get_theme_mod( 'hide_site_footer', false ) && is_front_page() && is_page() ) ) : // If this is the homepage and the footer elements are set to hide, don't load this part.
 
 
-					<?php get_template_part( 'template-parts/footer/footer', 'navigation' );
+				get_template_part( 'template-parts/footer/footer', 'widgets' );
 
 
-					get_template_part( 'template-parts/header/social', 'navigation' ); ?>
-
-				</div><!-- .footer-menus -->
-				<?php
+				if ( has_nav_menu( 'menu-2' ) || has_nav_menu( 'social' ) ) : ?>
+					<div class="footer-menus">
+						<?php 
+						get_template_part( 'template-parts/footer/footer', 'navigation' );
+						get_template_part( 'template-parts/header/social', 'navigation' ); ?>
+					</div><!-- .footer-menus -->
+					<?php
+				endif;
 			endif;
 			endif;
 		endif;
 		endif;
 		?>
 		?>

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

@@ -0,0 +1,20 @@
+<?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; ?>

+ 19 - 0
balasana/template-parts/header/site-navigation.php

@@ -0,0 +1,19 @@
+<?php if ( has_nav_menu( 'menu-1' ) ) : ?>
+	<nav id="site-navigation" class="main-navigation" aria-label="<?php esc_attr_e( 'Main Navigation', 'balasana' ); ?>">
+		<input type="checkbox" role="button" aria-haspopup="true" id="toggle" class="hide-visually">
+		<label for="toggle" id="toggle-menu" class="button">
+			<?php _e( 'Menu', 'balasana' ); ?>
+			<span class="hide-visually expanded-text"><?php _e( 'expanded', 'balasana' ); ?></span>
+			<span class="hide-visually collapsed-text"><?php _e( 'collapsed', 'balasana' ); ?></span>
+		</label>
+		<?php
+		wp_nav_menu(
+			array(
+				'theme_location' => 'menu-1',
+				'menu_class'     => 'main-menu',
+				'items_wrap'     => '<ul id="%1$s" class="%2$s" aria-label="submenu">%3$s</ul>',
+			)
+		);
+		?>
+	</nav><!-- #site-navigation -->
+<?php endif; ?>

+ 1 - 24
varia/header.php

@@ -10,11 +10,6 @@
  * @subpackage Varia
  * @subpackage Varia
  * @since 1.0.0
  * @since 1.0.0
  */
  */
-$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' : '';
 ?><!doctype html>
 ?><!doctype html>
 <html <?php language_attributes(); ?>>
 <html <?php language_attributes(); ?>>
 <head>
 <head>
@@ -35,24 +30,6 @@ if ( function_exists( 'wp_body_open' ) ) {
 <div id="page" class="site">
 <div id="page" class="site">
 	<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'varia' ); ?></a>
 	<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'varia' ); ?></a>
 
 
-	<?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="<?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 get_template_part( 'template-parts/header/header', 'content' ); ?>
 
 
 	<div id="content" class="site-content">
 	<div id="content" class="site-content">

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

@@ -0,0 +1,27 @@
+<?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; ?>