header.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
  33. <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
  34. <link rel="shortcut icon" type="image/x-icon" href="<?php echo home_url();?>/favicon.ico" />
  35. <?php wp_enqueue_script("jquery"); ?>
  36. <?php wp_head(); ?>
  37. </head>
  38. <body <?php body_class(); ?>>
  39. <div id="wrapper" class="hfeed">
  40. <div id="header">
  41. <div id="masthead">
  42. <div id="branding">
  43. <?php if ( is_home() || is_front_page() ) { ?>
  44. <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>
  45. <?php } else { ?>
  46. <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>
  47. <?php } ?>
  48. <div id="site-description"><?php bloginfo( 'description' ); ?></div>
  49. <?php
  50. // Retrieve the dimensions of the current post thumbnail -- no teensy header images for us!
  51. $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail');
  52. list($src, $width, $height) = $image;
  53. // Check if this is a post or page, if it has a thumbnail, and if it's a big one
  54. if ( is_singular() && has_post_thumbnail( $post->ID ) && $width >= HEADER_IMAGE_WIDTH ) :
  55. // Houston, we have a new header image!
  56. echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
  57. else : ?>
  58. <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>
  59. <?php endif; ?>
  60. </div><!-- #branding -->
  61. <div id="access">
  62. <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>
  63. <?php wp_nav_menu( array( 'sort_column' => 'menu_order', 'container_class' => 'menu-header' ) ); ?>
  64. </div><!-- #access -->
  65. </div><!-- #masthead -->
  66. </div><!-- #header -->
  67. <div id="main">