浏览代码

Merge pull request #1347 from Automattic/update/rivington-header-footer

Rivington: Updated header and footer
Takashi Irie 5 年之前
父节点
当前提交
f6343c006f
共有 6 个文件被更改,包括 209 次插入31 次删除
  1. 67 0
      rivington/footer.php
  2. 2 0
      rivington/functions.php
  3. 66 0
      rivington/header.php
  4. 22 9
      rivington/sass/_extra-child-theme.scss
  5. 32 17
      rivington/style-rtl.css
  6. 20 5
      rivington/style.css

+ 67 - 0
rivington/footer.php

@@ -0,0 +1,67 @@
+<?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 WordPress
+ * @subpackage Rivington
+ * @since 1.0.0
+ */
+
+?>
+
+	</div><!-- #content -->
+
+	<footer id="colophon" class="site-footer responsive-max-width">
+		<?php
+			if ( class_exists( 'A8C\FSE\WP_Template' ) ) : // If the FSE plugin is active, use the Header template for content.
+				$template = new A8C\FSE\WP_Template();
+				$template->output_template_content( A8C\FSE\WP_Template::FOOTER );
+			else : // Otherwise we'll fallback to the default footer below.
+				get_template_part( 'template-parts/footer/footer', 'widgets' );
+
+				if ( function_exists( 'the_privacy_policy_link' ) ) {
+					the_privacy_policy_link( '', '<span role="separator" aria-hidden="true"></span>' );
+				}
+
+				if ( has_nav_menu( 'social' ) ) : ?>
+					<nav class="social-navigation" aria-label="<?php esc_attr_e( 'Social Links Menu', 'rockfield' ); ?>">
+						<?php
+						wp_nav_menu(
+							array(
+								'theme_location' => 'social',
+								'menu_class'     => 'social-links-menu',
+								'link_before'    => '<span class="screen-reader-text">',
+								'link_after'     => '</span>' . varia_get_icon_svg( 'link' ),
+								'depth'          => 1,
+							)
+						);
+						?>
+					</nav><!-- .social-navigation -->
+				<?php endif;
+			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/', 'rivington' ) ); ?>" class="imprint">
+				<?php
+				/* translators: %s: WordPress. */
+				printf( __( 'proudly powered by %s.', 'rivington' ), 'WordPress' );
+				?>
+			</a>
+		</div><!-- .site-info -->
+	</footer><!-- #colophon -->
+
+</div><!-- #page -->
+
+<?php wp_footer(); ?>
+
+</body>
+</html>

+ 2 - 0
rivington/functions.php

@@ -104,6 +104,8 @@ if ( ! function_exists( 'rivington_setup' ) ) :
 				),
 			)
 		);
+		// Remove footer menu
+		unregister_nav_menu( 'menu-2' );
 	}
 endif;
 add_action( 'after_setup_theme', 'rivington_setup', 12 );

+ 66 - 0
rivington/header.php

@@ -0,0 +1,66 @@
+<?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 Rivington
+ * @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(); ?>>
+<div id="page" class="site">
+	<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'rivington' ); ?></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 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', 'rivington' ); ?>">
+					<input type="checkbox" role="button" aria-haspopup="true" id="toggle" class="hide-visually">
+					<label for="toggle" id="toggle-menu" class="button">
+						<?php _e( 'Menu', 'rivington' ); ?>
+						<span class="dropdown-icon open">+</span>
+						<span class="dropdown-icon close">&times;</span>
+						<span class="hide-visually expanded-text"><?php _e( 'expanded', 'rivington' ); ?></span>
+						<span class="hide-visually collapsed-text"><?php _e( 'collapsed', 'rivington' ); ?></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">

+ 22 - 9
rivington/sass/_extra-child-theme.scss

@@ -367,16 +367,29 @@ a {
 }
 
 /**
- * Footer Navigation
+ * Footer
  */
-.footer-navigation {
-	.footer-menu {
-		a {
-			padding: 0 #{0.5 * $spacing_unit};
-		}
 
-		> li:last-of-type {
-			margin-right: -#{0.5 * $spacing_unit};
-		}
+@include media(mobile-only) {
+	.site-info {
+		text-align: center;
+	}
+}
+
+//Social Navigation
+.social-navigation {
+	flex: 1 0 50%;
+	order: 2;
+	margin-bottom: 0;
+}
+
+.social-links-menu {
+	flex-wrap: wrap;
+	justify-content: flex-end;
+}
+
+@include media(mobile-only) {
+	.social-links-menu {
+		justify-content: center;
 	}
 }

+ 32 - 17
rivington/style-rtl.css

@@ -2198,15 +2198,15 @@ table th,
 }
 
 .margin-right-none {
-	margin-left: 0 !important;
+	margin-right: 0 !important;
 }
 
 .margin-right-half {
-	margin-left: 16px !important;
+	margin-right: 16px !important;
 }
 
 .margin-right-default {
-	margin-left: 32px !important;
+	margin-right: 32px !important;
 }
 
 .margin-bottom-none {
@@ -2222,15 +2222,15 @@ table th,
 }
 
 .margin-left-none {
-	margin-right: 0 !important;
+	margin-left: 0 !important;
 }
 
 .margin-left-half {
-	margin-right: 16px !important;
+	margin-left: 16px !important;
 }
 
 .margin-left-default {
-	margin-right: 32px !important;
+	margin-left: 32px !important;
 }
 
 /*
@@ -2249,15 +2249,15 @@ table th,
 }
 
 .padding-right-none {
-	padding-left: 0 !important;
+	padding-right: 0 !important;
 }
 
 .padding-right-half {
-	padding-left: 16px !important;
+	padding-right: 16px !important;
 }
 
 .padding-right-default {
-	padding-left: 32px !important;
+	padding-right: 32px !important;
 }
 
 .padding-bottom-none {
@@ -2273,15 +2273,15 @@ table th,
 }
 
 .padding-left-none {
-	padding-right: 0 !important;
+	padding-left: 0 !important;
 }
 
 .padding-left-half {
-	padding-right: 16px !important;
+	padding-left: 16px !important;
 }
 
 .padding-left-default {
-	padding-right: 32px !important;
+	padding-left: 32px !important;
 }
 
 /**
@@ -3773,12 +3773,27 @@ p:not(.site-title) a:hover {
 }
 
 /**
- * Footer Navigation
+ * Footer
  */
-.footer-navigation .footer-menu a {
-	padding: 0 8px;
+@media only screen and (max-width: 559px) {
+	.site-info {
+		text-align: center;
+	}
 }
 
-.footer-navigation .footer-menu > li:last-of-type {
-	margin-left: -8px;
+.social-navigation {
+	flex: 1 0 50%;
+	order: 2;
+	margin-bottom: 0;
+}
+
+.social-links-menu {
+	flex-wrap: wrap;
+	justify-content: flex-end;
+}
+
+@media only screen and (max-width: 559px) {
+	.social-links-menu {
+		justify-content: center;
+	}
 }

+ 20 - 5
rivington/style.css

@@ -3802,12 +3802,27 @@ p:not(.site-title) a:hover {
 }
 
 /**
- * Footer Navigation
+ * Footer
  */
-.footer-navigation .footer-menu a {
-	padding: 0 8px;
+@media only screen and (max-width: 559px) {
+	.site-info {
+		text-align: center;
+	}
 }
 
-.footer-navigation .footer-menu > li:last-of-type {
-	margin-right: -8px;
+.social-navigation {
+	flex: 1 0 50%;
+	order: 2;
+	margin-bottom: 0;
+}
+
+.social-links-menu {
+	flex-wrap: wrap;
+	justify-content: flex-end;
+}
+
+@media only screen and (max-width: 559px) {
+	.social-links-menu {
+		justify-content: center;
+	}
 }