[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

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.0">
  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">
  29              <?php
  30              /* translators: Hidden accessibility text. */
  31              _e( 'Skip to content', 'twentysixteen' );
  32              ?>
  33          </a>
  34  
  35          <header id="masthead" class="site-header">
  36              <div class="site-header-main">
  37                  <div class="site-branding">
  38                      <?php
  39                      twentysixteen_the_custom_logo();
  40                      $is_front  = ! is_paged() && ( is_front_page() || ( is_home() && ( (int) get_option( 'page_for_posts' ) !== get_queried_object_id() ) ) );
  41                      $site_name = get_bloginfo( 'name', 'display' );
  42  
  43                      if ( $site_name && is_front_page() && is_home() ) :
  44                          ?>
  45                          <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php echo $is_front ? 'aria-current="page"' : ''; ?>><?php echo $site_name; ?></a></h1>
  46                      <?php elseif ( $site_name ) : ?>
  47                          <p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php echo $is_front ? 'aria-current="page"' : ''; ?>><?php echo $site_name; ?></a></p>
  48                          <?php
  49                      endif;
  50  
  51                      $description = get_bloginfo( 'description', 'display' );
  52                      if ( $description || is_customize_preview() ) :
  53                          ?>
  54                          <p class="site-description"><?php echo $description; ?></p>
  55                      <?php endif; ?>
  56                  </div><!-- .site-branding -->
  57  
  58                  <?php if ( has_nav_menu( 'primary' ) || has_nav_menu( 'social' ) ) : ?>
  59                      <button id="menu-toggle" class="menu-toggle"><?php _e( 'Menu', 'twentysixteen' ); ?></button>
  60  
  61                      <div id="site-header-menu" class="site-header-menu">
  62                          <?php if ( has_nav_menu( 'primary' ) ) : ?>
  63                              <nav id="site-navigation" class="main-navigation" aria-label="<?php esc_attr_e( 'Primary Menu', 'twentysixteen' ); ?>">
  64                                  <?php
  65                                      wp_nav_menu(
  66                                          array(
  67                                              'theme_location' => 'primary',
  68                                              'menu_class' => 'primary-menu',
  69                                          )
  70                                      );
  71                                  ?>
  72                              </nav><!-- .main-navigation -->
  73                          <?php endif; ?>
  74  
  75                          <?php if ( has_nav_menu( 'social' ) ) : ?>
  76                              <nav id="social-navigation" class="social-navigation" aria-label="<?php esc_attr_e( 'Social Links Menu', 'twentysixteen' ); ?>">
  77                                  <?php
  78                                      wp_nav_menu(
  79                                          array(
  80                                              'theme_location' => 'social',
  81                                              'menu_class'  => 'social-links-menu',
  82                                              'depth'       => 1,
  83                                              'link_before' => '<span class="screen-reader-text">',
  84                                              'link_after'  => '</span>',
  85                                          )
  86                                      );
  87                                  ?>
  88                              </nav><!-- .social-navigation -->
  89                          <?php endif; ?>
  90                      </div><!-- .site-header-menu -->
  91                  <?php endif; ?>
  92              </div><!-- .site-header-main -->
  93  
  94              <?php if ( get_header_image() ) : ?>
  95                  <?php
  96                      /**
  97                       * Filters the default twentysixteen custom header sizes attribute.
  98                       *
  99                       * @since Twenty Sixteen 1.0
 100                       *
 101                       * @param string $custom_header_sizes sizes attribute
 102                       * for Custom Header. Default '(max-width: 709px) 85vw,
 103                       * (max-width: 909px) 81vw, (max-width: 1362px) 88vw, 1200px'.
 104                       */
 105                      $custom_header_sizes = apply_filters( 'twentysixteen_custom_header_sizes', '(max-width: 709px) 85vw, (max-width: 909px) 81vw, (max-width: 1362px) 88vw, 1200px' );
 106                  ?>
 107                  <div class="header-image">
 108                      <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php echo $is_front ? 'aria-current="page"' : ''; ?>>
 109                          <?php
 110                          $custom_header = get_custom_header();
 111                          $attrs         = array(
 112                              'alt'    => get_bloginfo( 'name', 'display' ),
 113                              'sizes'  => $custom_header_sizes,
 114                              'height' => $custom_header->height,
 115                              'width'  => $custom_header->width,
 116                          );
 117  
 118                          the_header_image_tag( $attrs );
 119                          ?>
 120                      </a>
 121                  </div><!-- .header-image -->
 122              <?php endif; // End header image check. ?>
 123          </header><!-- .site-header -->
 124  
 125          <div id="content" class="site-content">


Generated : Fri Jul 25 08:20:01 2025 Cross-referenced by PHPXref