[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

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


Generated : Tue Jun 16 08:20:09 2026 Cross-referenced by PHPXref