[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-content/themes/twentysixteen/ -> header.php (source)

   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="https://gmpg.org/xfn/11">
  18      <?php if ( is_singular() && pings_open( get_queried_object() ) ) : ?>
  19      <link rel="pingback" href="<?php echo esc_url( get_bloginfo( 'pingback_url' ) ); ?>">
  20      <?php endif; ?>
  21      <?php wp_head(); ?>
  22  </head>
  23  
  24  <body <?php body_class(); ?>>
  25  <?php wp_body_open(); ?>
  26  <div id="page" class="site">
  27      <div class="site-inner">
  28          <a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'twentysixteen' ); ?></a>
  29  
  30          <header id="masthead" class="site-header">
  31              <div class="site-header-main">
  32                  <div class="site-branding">
  33                      <?php twentysixteen_the_custom_logo(); ?>
  34  
  35                      <?php if ( is_front_page() && is_home() ) : ?>
  36                          <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
  37                      <?php else : ?>
  38                          <p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
  39                          <?php
  40                      endif;
  41  
  42                      $description = get_bloginfo( 'description', 'display' );
  43                      if ( $description || is_customize_preview() ) :
  44                          ?>
  45                          <p class="site-description"><?php echo $description; ?></p>
  46                      <?php endif; ?>
  47                  </div><!-- .site-branding -->
  48  
  49                  <?php if ( has_nav_menu( 'primary' ) || has_nav_menu( 'social' ) ) : ?>
  50                      <button id="menu-toggle" class="menu-toggle"><?php _e( 'Menu', 'twentysixteen' ); ?></button>
  51  
  52                      <div id="site-header-menu" class="site-header-menu">
  53                          <?php if ( has_nav_menu( 'primary' ) ) : ?>
  54                              <nav id="site-navigation" class="main-navigation" aria-label="<?php esc_attr_e( 'Primary Menu', 'twentysixteen' ); ?>">
  55                                  <?php
  56                                      wp_nav_menu(
  57                                          array(
  58                                              'theme_location' => 'primary',
  59                                              'menu_class' => 'primary-menu',
  60                                          )
  61                                      );
  62                                  ?>
  63                              </nav><!-- .main-navigation -->
  64                          <?php endif; ?>
  65  
  66                          <?php if ( has_nav_menu( 'social' ) ) : ?>
  67                              <nav id="social-navigation" class="social-navigation" aria-label="<?php esc_attr_e( 'Social Links Menu', 'twentysixteen' ); ?>">
  68                                  <?php
  69                                      wp_nav_menu(
  70                                          array(
  71                                              'theme_location' => 'social',
  72                                              'menu_class'  => 'social-links-menu',
  73                                              'depth'       => 1,
  74                                              'link_before' => '<span class="screen-reader-text">',
  75                                              'link_after'  => '</span>',
  76                                          )
  77                                      );
  78                                  ?>
  79                              </nav><!-- .social-navigation -->
  80                          <?php endif; ?>
  81                      </div><!-- .site-header-menu -->
  82                  <?php endif; ?>
  83              </div><!-- .site-header-main -->
  84  
  85              <?php if ( get_header_image() ) : ?>
  86                  <?php
  87                      /**
  88                       * Filters the default twentysixteen custom header sizes attribute.
  89                       *
  90                       * @since Twenty Sixteen 1.0
  91                       *
  92                       * @param string $custom_header_sizes sizes attribute
  93                       * for Custom Header. Default '(max-width: 709px) 85vw,
  94                       * (max-width: 909px) 81vw, (max-width: 1362px) 88vw, 1200px'.
  95                       */
  96                      $custom_header_sizes = apply_filters( 'twentysixteen_custom_header_sizes', '(max-width: 709px) 85vw, (max-width: 909px) 81vw, (max-width: 1362px) 88vw, 1200px' );
  97                  ?>
  98                  <div class="header-image">
  99                      <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
 100                          <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' ) ); ?>" />
 101                      </a>
 102                  </div><!-- .header-image -->
 103              <?php endif; // End header image check. ?>
 104          </header><!-- .site-header -->
 105  
 106          <div id="content" class="site-content">


Generated: Mon Apr 29 01:00:03 2024 Cross-referenced by PHPXref 0.7.1