[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

   1  <?php
   2  /**
   3   * Header template for our theme
   4   *
   5   * Displays all of the <head> section and everything up till <div id="main">.
   6   *
   7   * @package WordPress
   8   * @subpackage Twenty_Ten
   9   * @since Twenty Ten 1.0
  10   */
  11  ?><!DOCTYPE html>
  12  <html <?php language_attributes(); ?>>
  13  <head>
  14  <meta charset="<?php bloginfo( 'charset' ); ?>" />
  15  <title>
  16  <?php
  17      /*
  18       * Print the <title> tag based on what is being viewed.
  19       */
  20      global $page, $paged;
  21  
  22      wp_title( '|', true, 'right' );
  23  
  24      // Add the blog name.
  25      bloginfo( 'name' );
  26  
  27      // Add the blog description for the home/front page.
  28      $site_description = get_bloginfo( 'description', 'display' );
  29  if ( $site_description && ( is_home() || is_front_page() ) ) {
  30      echo " | $site_description";
  31  }
  32  
  33      // Add a page number if necessary:
  34  if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
  35      /* translators: %s: Page number. */
  36      echo esc_html( ' | ' . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) ) );
  37  }
  38  
  39  ?>
  40      </title>
  41  <link rel="profile" href="http://gmpg.org/xfn/11" />
  42  <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>?ver=20190507" />
  43  <link rel="pingback" href="<?php echo esc_url( get_bloginfo( 'pingback_url' ) ); ?>">
  44  <?php
  45      /*
  46       * We add some JavaScript to pages with the comment form
  47       * to support sites with threaded comments (when in use).
  48       */
  49  if ( is_singular() && get_option( 'thread_comments' ) ) {
  50      wp_enqueue_script( 'comment-reply' );
  51  }
  52  
  53      /*
  54       * Always have wp_head() just before the closing </head>
  55       * tag of your theme, or you will break many plugins, which
  56       * generally use this hook to add elements to <head> such
  57       * as styles, scripts, and meta tags.
  58       */
  59      wp_head();
  60  ?>
  61  </head>
  62  
  63  <body <?php body_class(); ?>>
  64  <?php wp_body_open(); ?>
  65  <div id="wrapper" class="hfeed">
  66      <div id="header">
  67          <div id="masthead">
  68              <div id="branding" role="banner">
  69                  <?php $heading_tag = ( is_home() || is_front_page() ) ? 'h1' : 'div'; ?>
  70                  <<?php echo $heading_tag; ?> id="site-title">
  71                      <span>
  72                          <a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a>
  73                      </span>
  74                  </<?php echo $heading_tag; ?>>
  75                  <div id="site-description"><?php bloginfo( 'description' ); ?></div>
  76  
  77                  <?php
  78                      // Compatibility with versions of WordPress prior to 3.4.
  79                  if ( function_exists( 'get_custom_header' ) ) {
  80                      /*
  81                       * We need to figure out what the minimum width should be for our featured image.
  82                       * This result would be the suggested width if the theme were to implement flexible widths.
  83                       */
  84                      $header_image_width = get_theme_support( 'custom-header', 'width' );
  85                  } else {
  86                      $header_image_width = HEADER_IMAGE_WIDTH;
  87                  }
  88  
  89                  // Check if this is a post or page, if it has a thumbnail, and if it's a big one.
  90                  if ( is_singular() && has_post_thumbnail( $post->ID ) ) {
  91                      $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) );
  92                      if ( $image && $image[1] >= $header_image_width ) {
  93                          // Houston, we have a new header image!
  94                          echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
  95                      }
  96                  } else {
  97                      // Compatibility with versions of WordPress prior to 3.4.
  98                      if ( function_exists( 'get_custom_header' ) ) {
  99                          $header_image_width  = get_custom_header()->width;
 100                          $header_image_height = get_custom_header()->height;
 101                      } else {
 102                          $header_image_width  = HEADER_IMAGE_WIDTH;
 103                          $header_image_height = HEADER_IMAGE_HEIGHT;
 104                      }
 105                      ?>
 106                      <img src="<?php header_image(); ?>" width="<?php echo esc_attr( $header_image_width ); ?>" height="<?php echo esc_attr( $header_image_height ); ?>" alt="" />
 107                      <?php
 108                  } // End check for featured image or standard header.
 109                  ?>
 110              </div><!-- #branding -->
 111  
 112              <div id="access" role="navigation">
 113                  <?php // Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff. ?>
 114                  <div class="skip-link screen-reader-text"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentyten' ); ?>"><?php _e( 'Skip to content', 'twentyten' ); ?></a></div>
 115                  <?php
 116                  /*
 117                   * Our navigation menu. If one isn't filled out, wp_nav_menu() falls back to wp_page_menu().
 118                   * The menu assigned to the primary location is the one used.
 119                   * If one isn't assigned, the menu with the lowest ID is used.
 120                   */
 121                  wp_nav_menu(
 122                      array(
 123                          'container_class' => 'menu-header',
 124                          'theme_location'  => 'primary',
 125                      )
 126                  );
 127                  ?>
 128              </div><!-- #access -->
 129          </div><!-- #masthead -->
 130      </div><!-- #header -->
 131  
 132      <div id="main">


Generated: Wed Feb 26 01:00:04 2020 Cross-referenced by PHPXref 0.7.1