فهرست منبع

add support for site logo in the header to morden

Ben Dwyer 4 سال پیش
والد
کامیت
bb993271d6
3فایلهای تغییر یافته به همراه21 افزوده شده و 11 حذف شده
  1. 13 9
      morden/header.php
  2. 4 1
      morden/style-rtl.css
  3. 4 1
      morden/style.css

+ 13 - 9
morden/header.php

@@ -10,6 +10,11 @@
  * @subpackage Varia
  * @subpackage Varia
  * @since 1.0.0
  * @since 1.0.0
  */
  */
+$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', true ) ? ' 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>
@@ -32,7 +37,7 @@
 
 
 	<?php if ( class_exists( 'A8C\FSE\WP_Template' ) ) : // If the FSE plugin is active, use the Header template for content. ?>
 	<?php if ( class_exists( 'A8C\FSE\WP_Template' ) ) : // If the FSE plugin is active, use the Header template for content. ?>
 
 
-		<header class="fse-template-part fse-header entry-content">
+		<header id="masthead" class="fse-template-part fse-header entry-content">
 			<?php
 			<?php
 				$template = new A8C\FSE\WP_Template();
 				$template = new A8C\FSE\WP_Template();
 				$template->output_template_content( A8C\FSE\WP_Template::HEADER );
 				$template->output_template_content( A8C\FSE\WP_Template::HEADER );
@@ -40,15 +45,13 @@
 		</header>
 		</header>
 
 
 	<?php else : // Otherwise we'll fallback to the default Varia header below. ?>
 	<?php else : // Otherwise we'll fallback to the default Varia header below. ?>
-
-		<header id="masthead" class="site-header">
-
-			<div class="site-header-wrap">
-
+		<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', 'branding' ); ?>
 
 
-				<?php if ( has_nav_menu( 'menu-1' ) ) : ?>
+				<?php if ( $has_primary_nav ) : ?>
 					<nav id="site-navigation" class="main-navigation" aria-label="<?php esc_attr_e( 'Main Navigation', 'varia' ); ?>">
 					<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">
 						<input type="checkbox" role="button" aria-haspopup="true" id="toggle" class="hide-visually">
 						<label for="toggle" id="toggle-menu" class="button">
 						<label for="toggle" id="toggle-menu" class="button">
 							<?php _e( 'Menu', 'varia' ); ?>
 							<?php _e( 'Menu', 'varia' ); ?>
@@ -57,6 +60,7 @@
 							<span class="hide-visually expanded-text"><?php _e( 'expanded', 'varia' ); ?></span>
 							<span class="hide-visually expanded-text"><?php _e( 'expanded', 'varia' ); ?></span>
 							<span class="hide-visually collapsed-text"><?php _e( 'collapsed', 'varia' ); ?></span>
 							<span class="hide-visually collapsed-text"><?php _e( 'collapsed', 'varia' ); ?></span>
 						</label>
 						</label>
+
 						<?php
 						<?php
 						wp_nav_menu(
 						wp_nav_menu(
 							array(
 							array(
@@ -70,7 +74,7 @@
 				<?php endif; ?>
 				<?php endif; ?>
 
 
 				<?php if ( has_nav_menu( 'social' ) ) : ?>
 				<?php if ( has_nav_menu( 'social' ) ) : ?>
-					<nav class="social-navigation" aria-label="<?php esc_attr_e( 'Social Links Menu', 'varia' ); ?>">
+					<nav class="social-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Social Links Menu', 'varia' ); ?>">
 						<?php
 						<?php
 						wp_nav_menu(
 						wp_nav_menu(
 							array(
 							array(
@@ -85,7 +89,7 @@
 					</nav><!-- .social-navigation -->
 					</nav><!-- .social-navigation -->
 				<?php endif; ?>
 				<?php endif; ?>
 
 
-			</div>
+			</div><!-- .site-header-wrap -->
 
 
 		</header><!-- #masthead -->
 		</header><!-- #masthead -->
 
 

+ 4 - 1
morden/style-rtl.css

@@ -16,7 +16,7 @@ Tags: one-column, flexible-header, accessibility-ready, custom-colors, custom-me
 This theme, like WordPress, is licensed under the GPL.
 This theme, like WordPress, is licensed under the GPL.
 Use it to make something cool, have fun, and share what you've learned with others.
 Use it to make something cool, have fun, and share what you've learned with others.
 
 
-Varia is based on Underscores https://underscores.me/, (C) 2012-2019 Automattic, Inc.
+Morden is a child theme of Varia which is based on Underscores https://underscores.me/, (C) 2012-2019 Automattic, Inc.
 Underscores is distributed under the terms of the GNU GPL v2 or later.
 Underscores is distributed under the terms of the GNU GPL v2 or later.
 
 
 Normalizing styles have been helped along thanks to the fine work of
 Normalizing styles have been helped along thanks to the fine work of
@@ -4105,6 +4105,9 @@ p:not(.site-title) a:hover {
 		margin-top: 0;
 		margin-top: 0;
 		margin-bottom: 0;
 		margin-bottom: 0;
 	}
 	}
+	.site-header-wrap.has-logo:not(.has-title-and-tagline) {
+		grid-template-areas: "site-logo main-navigation" "site-logo social-navigation";
+	}
 	.site-header-wrap .site-logo {
 	.site-header-wrap .site-logo {
 		grid-area: site-logo;
 		grid-area: site-logo;
 		margin-bottom: 16px;
 		margin-bottom: 16px;

+ 4 - 1
morden/style.css

@@ -16,7 +16,7 @@ Tags: one-column, flexible-header, accessibility-ready, custom-colors, custom-me
 This theme, like WordPress, is licensed under the GPL.
 This theme, like WordPress, is licensed under the GPL.
 Use it to make something cool, have fun, and share what you've learned with others.
 Use it to make something cool, have fun, and share what you've learned with others.
 
 
-Varia is based on Underscores https://underscores.me/, (C) 2012-2019 Automattic, Inc.
+Morden is a child theme of Varia which is based on Underscores https://underscores.me/, (C) 2012-2019 Automattic, Inc.
 Underscores is distributed under the terms of the GNU GPL v2 or later.
 Underscores is distributed under the terms of the GNU GPL v2 or later.
 
 
 Normalizing styles have been helped along thanks to the fine work of
 Normalizing styles have been helped along thanks to the fine work of
@@ -4134,6 +4134,9 @@ p:not(.site-title) a:hover {
 		margin-top: 0;
 		margin-top: 0;
 		margin-bottom: 0;
 		margin-bottom: 0;
 	}
 	}
+	.site-header-wrap.has-logo:not(.has-title-and-tagline) {
+		grid-template-areas: "site-logo main-navigation" "site-logo social-navigation";
+	}
 	.site-header-wrap .site-logo {
 	.site-header-wrap .site-logo {
 		grid-area: site-logo;
 		grid-area: site-logo;
 		margin-bottom: 16px;
 		margin-bottom: 16px;