header.php 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * The Header 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 3.0.0
  10. */
  11. ?>
  12. <!DOCTYPE html>
  13. <html <?php language_attributes(); ?>>
  14. <head>
  15. <meta charset="<?php bloginfo( 'charset' ); ?>" />
  16. <title><?php
  17. // Returns the title based on the type of page being viewed
  18. if ( is_single() ) {
  19. bloginfo( 'name' ); echo ' | '; single_post_title();
  20. } elseif ( is_home() || is_front_page() ) {
  21. bloginfo( 'name' ); echo ' | '; bloginfo( 'description' ); twentyten_the_page_number();
  22. } elseif ( is_page() ) {
  23. bloginfo( 'name' ); echo ' | '; single_post_title();
  24. } elseif ( is_search() ) {
  25. printf( __( 'Search results for "%s"', 'twentyten' ), esc_html( $s ) ); twentyten_the_page_number(); echo ' | '; bloginfo( 'name' );
  26. } elseif ( is_404() ) {
  27. _e( 'Not Found', 'twentyten' ); echo ' | '; bloginfo( 'name' );
  28. } else {
  29. wp_title( '' ); echo ' | '; bloginfo( 'name' ); twentyten_the_page_number();
  30. }
  31. ?></title>
  32. <link rel="profile" href="http://gmpg.org/xfn/11" />
  33. <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
  34. <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
  35. <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
  36. <?php wp_enqueue_script("jquery"); ?>
  37. <?php wp_head(); ?>
  38. </head>
  39. <body <?php body_class(); ?>>
  40. <div id="wrapper" class="hfeed">
  41. <div id="header">
  42. <div id="masthead">
  43. <div id="branding">
  44. <?php if ( is_home() || is_front_page() ) { ?>
  45. <h1 id="site-title"><span><a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></span></h1>
  46. <?php } else { ?>
  47. <div id="site-title"><span><a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></span></div>
  48. <?php } ?>
  49. <div id="site-description"><?php bloginfo( 'description' ); ?></div>
  50. <?php
  51. // Retrieve the dimensions of the current post thumbnail -- no teensy header images for us!
  52. $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail');
  53. list($src, $width, $height) = $image;
  54. // Check if this is a post or page, if it has a thumbnail, and if it's a big one
  55. if ( is_singular() && has_post_thumbnail( $post->ID ) && $width >= HEADER_IMAGE_WIDTH ) :
  56. // Houston, we have a new header image!
  57. echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
  58. else : ?>
  59. <a href="<?php bloginfo( 'url' ) ?>/" title="<?php bloginfo( 'name' ) ?>" rel="home"><img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" /></a>
  60. <?php endif; ?>
  61. </div><!-- #branding -->
  62. <div id="access">
  63. <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>
  64. <?php wp_nav_menu( array( 'sort_column' => 'menu_order', 'container_class' => 'menu-header' ) ); ?>
  65. </div><!-- #access -->
  66. </div><!-- #masthead -->
  67. </div><!-- #header -->
  68. <div id="main">