wp/wp-content/themes/twentysixteen/header.php
changeset 7 cf61fcea0001
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
       
     1 <?php
       
     2 /**
       
     3  * The template for displaying the header
       
     4  *
       
     5  * Displays all of the head element and everything up until the "site-content" div.
       
     6  *
       
     7  * @package WordPress
       
     8  * @subpackage Twenty_Sixteen
       
     9  * @since Twenty Sixteen 1.0
       
    10  */
       
    11 
       
    12 ?><!DOCTYPE html>
       
    13 <html <?php language_attributes(); ?> class="no-js">
       
    14 <head>
       
    15 	<meta charset="<?php bloginfo( 'charset' ); ?>">
       
    16 	<meta name="viewport" content="width=device-width, initial-scale=1">
       
    17 	<link rel="profile" href="http://gmpg.org/xfn/11">
       
    18 	<?php if ( is_singular() && pings_open( get_queried_object() ) ) : ?>
       
    19 	<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
       
    20 	<?php endif; ?>
       
    21 	<?php wp_head(); ?>
       
    22 </head>
       
    23 
       
    24 <body <?php body_class(); ?>>
       
    25 <div id="page" class="site">
       
    26 	<div class="site-inner">
       
    27 		<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'twentysixteen' ); ?></a>
       
    28 
       
    29 		<header id="masthead" class="site-header" role="banner">
       
    30 			<div class="site-header-main">
       
    31 				<div class="site-branding">
       
    32 					<?php twentysixteen_the_custom_logo(); ?>
       
    33 
       
    34 					<?php if ( is_front_page() && is_home() ) : ?>
       
    35 						<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
       
    36 					<?php else : ?>
       
    37 						<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
       
    38 					<?php endif;
       
    39 
       
    40 					$description = get_bloginfo( 'description', 'display' );
       
    41 					if ( $description || is_customize_preview() ) : ?>
       
    42 						<p class="site-description"><?php echo $description; ?></p>
       
    43 					<?php endif; ?>
       
    44 				</div><!-- .site-branding -->
       
    45 
       
    46 				<?php if ( has_nav_menu( 'primary' ) || has_nav_menu( 'social' ) ) : ?>
       
    47 					<button id="menu-toggle" class="menu-toggle"><?php _e( 'Menu', 'twentysixteen' ); ?></button>
       
    48 
       
    49 					<div id="site-header-menu" class="site-header-menu">
       
    50 						<?php if ( has_nav_menu( 'primary' ) ) : ?>
       
    51 							<nav id="site-navigation" class="main-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Primary Menu', 'twentysixteen' ); ?>">
       
    52 								<?php
       
    53 									wp_nav_menu( array(
       
    54 										'theme_location' => 'primary',
       
    55 										'menu_class'     => 'primary-menu',
       
    56 									 ) );
       
    57 								?>
       
    58 							</nav><!-- .main-navigation -->
       
    59 						<?php endif; ?>
       
    60 
       
    61 						<?php if ( has_nav_menu( 'social' ) ) : ?>
       
    62 							<nav id="social-navigation" class="social-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Social Links Menu', 'twentysixteen' ); ?>">
       
    63 								<?php
       
    64 									wp_nav_menu( array(
       
    65 										'theme_location' => 'social',
       
    66 										'menu_class'     => 'social-links-menu',
       
    67 										'depth'          => 1,
       
    68 										'link_before'    => '<span class="screen-reader-text">',
       
    69 										'link_after'     => '</span>',
       
    70 									) );
       
    71 								?>
       
    72 							</nav><!-- .social-navigation -->
       
    73 						<?php endif; ?>
       
    74 					</div><!-- .site-header-menu -->
       
    75 				<?php endif; ?>
       
    76 			</div><!-- .site-header-main -->
       
    77 
       
    78 			<?php if ( get_header_image() ) : ?>
       
    79 				<?php
       
    80 					/**
       
    81 					 * Filter the default twentysixteen custom header sizes attribute.
       
    82 					 *
       
    83 					 * @since Twenty Sixteen 1.0
       
    84 					 *
       
    85 					 * @param string $custom_header_sizes sizes attribute
       
    86 					 * for Custom Header. Default '(max-width: 709px) 85vw,
       
    87 					 * (max-width: 909px) 81vw, (max-width: 1362px) 88vw, 1200px'.
       
    88 					 */
       
    89 					$custom_header_sizes = apply_filters( 'twentysixteen_custom_header_sizes', '(max-width: 709px) 85vw, (max-width: 909px) 81vw, (max-width: 1362px) 88vw, 1200px' );
       
    90 				?>
       
    91 				<div class="header-image">
       
    92 					<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
       
    93 						<img src="<?php header_image(); ?>" srcset="<?php echo esc_attr( wp_get_attachment_image_srcset( get_custom_header()->attachment_id ) ); ?>" sizes="<?php echo esc_attr( $custom_header_sizes ); ?>" width="<?php echo esc_attr( get_custom_header()->width ); ?>" height="<?php echo esc_attr( get_custom_header()->height ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>">
       
    94 					</a>
       
    95 				</div><!-- .header-image -->
       
    96 			<?php endif; // End header image check. ?>
       
    97 		</header><!-- .site-header -->
       
    98 
       
    99 		<div id="content" class="site-content">