فهرست منبع

Stratford header and footer

Maggie Cabrera 4 سال پیش
والد
کامیت
6e1a5988f7
3فایلهای تغییر یافته به همراه46 افزوده شده و 76 حذف شده
  1. 0 68
      stratford/header.php
  2. 20 8
      stratford/template-parts/footer/footer-content.php
  3. 26 0
      stratford/template-parts/header/header-content.php

+ 0 - 68
stratford/header.php

@@ -1,68 +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 Stratford
- * @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', 'varia' ); ?></a>
-
-		<header id="masthead" class="site-header alignfull">
-			
-			<div class="site-header-wrapper">
-				
-				<?php get_template_part( 'template-parts/header/site', 'branding' ); ?>
-			
-				
-				<?php if ( has_nav_menu( 'menu-1' ) ) : ?>
-				<div id="site-menu" class="site-menu">
-					<nav id="site-navigation" class="main-navigation" aria-label="<?php esc_attr_e( 'Main Navigation', 'varia' ); ?>">
-						<input type="checkbox" role="button" aria-haspopup="true" id="toggle" class="hide-visually">
-						<label for="toggle" id="toggle-menu" class="button">
-							<?php _e( 'Menu', 'varia' ); ?>
-							<span class="dropdown-icon open">+</span>
-							<span class="dropdown-icon close">&times;</span>
-							<span class="hide-visually expanded-text"><?php _e( 'expanded', 'varia' ); ?></span>
-							<span class="hide-visually collapsed-text"><?php _e( 'collapsed', 'varia' ); ?></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 -->
-				</div><!-- .site-menu -->
-				<?php endif; ?>
-				
-			</div>
-
-		</header><!-- #masthead -->
-
-	<div id="content" class="site-content">

+ 20 - 8
stratford/template-parts/footer/footer-content.php

@@ -1,8 +1,20 @@
-<footer id="colophon" class="site-footer responsive-max-width">
-	<?php get_template_part( 'template-parts/footer/footer', 'widgets' ); ?>
-	<?php get_template_part( 'template-parts/header/social', 'navigation' ); ?>
-	<div class="site-info">
-		<?php get_template_part( 'template-parts/footer/privacy', 'policy' ); ?>
-		<?php get_template_part( 'template-parts/footer/site', 'name' ); ?>
-	</div><!-- .site-info -->
-</footer><!-- #colophon -->
+<?php if ( class_exists( 'A8C\FSE\WP_Template' ) ) : // If the FSE plugin is active, use the Header template for content. ?>
+	<footer class="fse-template-part fse-footer entry-content">
+	<?php
+		$template = new A8C\FSE\WP_Template();
+		$template->output_template_content( A8C\FSE\WP_Template::FOOTER );
+	else : // Otherwise we'll fallback to the default Varia footer below.
+		?>
+	<footer id="colophon" class="site-footer responsive-max-width">
+			<?php
+				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.
+					get_template_part( 'template-parts/footer/footer', 'widgets' );
+					get_template_part( 'template-parts/header/social', 'navigation' ); 
+				endif;
+			?>
+	<?php endif; ?>
+		<div class="site-info">
+			<?php get_template_part( 'template-parts/footer/privacy', 'policy' ); ?>
+			<?php get_template_part( 'template-parts/footer/site', 'name' ); ?>
+		</div><!-- .site-info -->
+	</footer><!-- #colophon -->

+ 26 - 0
stratford/template-parts/header/header-content.php

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