| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Header template for the theme 4 * 5 * Displays all of the <head> section and everything up till <div id="main">. 6 * 7 * @package WordPress 8 * @subpackage Twenty_Eleven 9 * @since Twenty Eleven 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 <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 23 <title> 24 <?php 25 // Print the <title> tag based on what is being viewed. 26 wp_title( '|', true, 'right' ); 27 28 // Add the site name. 29 bloginfo( 'name' ); 30 31 // Add the site description for the home/front page. 32 $site_description = get_bloginfo( 'description', 'display' ); 33 if ( $site_description && ( is_home() || is_front_page() ) ) { 34 echo " | $site_description"; 35 } 36 37 // Add a page number if necessary: 38 if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { 39 /* translators: %s: Page number. */ 40 echo esc_html( ' | ' . sprintf( __( 'Page %s', 'twentyeleven' ), max( $paged, $page ) ) ); 41 } 42 43 ?> 44 </title> 45 <link rel="profile" href="https://gmpg.org/xfn/11" /> 46 <link rel="stylesheet" media="all" href="<?php echo esc_url( get_stylesheet_uri() ); ?>?ver=20260520" /> 47 <link rel="pingback" href="<?php echo esc_url( get_bloginfo( 'pingback_url' ) ); ?>"> 48 <?php 49 /* 50 * We add some JavaScript to pages with the comment form 51 * to support sites with threaded comments (when in use). 52 */ 53 if ( is_singular() && get_option( 'thread_comments' ) ) { 54 wp_enqueue_script( 'comment-reply' ); 55 } 56 57 /* 58 * Always have wp_head() just before the closing </head> 59 * tag of your theme, or you will break many plugins, which 60 * generally use this hook to add elements to <head> such 61 * as styles, scripts, and meta tags. 62 */ 63 wp_head(); 64 ?> 65 </head> 66 67 <body <?php body_class(); ?>> 68 <?php wp_body_open(); ?> 69 <div id="page" class="hfeed"> 70 <header id="branding"> 71 <hgroup> 72 <?php 73 $is_front = ! is_paged() && ( is_front_page() || ( is_home() && ( (int) get_option( 'page_for_posts' ) !== get_queried_object_id() ) ) ); 74 $site_name = get_bloginfo( 'name', 'display' ); 75 $site_description = get_bloginfo( 'description', 'display' ); 76 77 if ( $site_name ) : 78 ?> 79 <h1 id="site-title"><span><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php echo $is_front ? 'aria-current="page"' : ''; ?>><?php echo $site_name; ?></a></span></h1> 80 <?php 81 endif; 82 83 if ( $site_description ) : 84 ?> 85 <h2 id="site-description"><?php echo $site_description; ?></h2> 86 <?php endif; ?> 87 </hgroup> 88 89 <?php 90 // Check to see if the header image has been removed. 91 $header_image = get_header_image(); 92 if ( $header_image ) : 93 // Compatibility with versions of WordPress prior to 3.4. 94 if ( function_exists( 'get_custom_header' ) ) { 95 /* 96 * We need to figure out what the minimum width should be for our featured image. 97 * This result would be the suggested width if the theme were to implement flexible widths. 98 */ 99 $header_image_width = get_theme_support( 'custom-header', 'width' ); 100 } else { 101 $header_image_width = HEADER_IMAGE_WIDTH; 102 } 103 ?> 104 <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" <?php echo $is_front ? 'aria-current="page"' : ''; ?>> 105 <?php 106 /* 107 * The header image. 108 * Check if this is a post or page, if it has a thumbnail, and if it's a big one 109 */ 110 $image = false; 111 if ( is_singular() && has_post_thumbnail( $post->ID ) ) { 112 $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) ); 113 } 114 if ( $image && $image[1] >= $header_image_width ) { 115 // Houston, we have a new header image! 116 echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' ); 117 } else { 118 twentyeleven_header_image(); 119 } // End check for featured image or standard header. 120 ?> 121 </a> 122 <?php endif; // End check for removed header image. ?> 123 124 <?php 125 // Has the text been hidden? 126 if ( 'blank' === get_header_textcolor() ) : 127 $header_image_class = ''; 128 if ( $header_image ) { 129 $header_image_class = ' with-image'; 130 } 131 ?> 132 <div class="only-search<?php echo $header_image_class; ?>"> 133 <?php get_search_form(); ?> 134 </div> 135 <?php 136 else : 137 ?> 138 <?php get_search_form(); ?> 139 <?php endif; ?> 140 141 <nav id="access"> 142 <h3 class="assistive-text"><?php _e( 'Main menu', 'twentyeleven' ); ?></h3> 143 <?php 144 /* 145 * Our navigation menu. If one isn't filled out, wp_nav_menu() falls back to wp_page_menu(). 146 * The menu assigned to the primary location is the one used. 147 * If one isn't assigned, the menu with the lowest ID is used. 148 */ 149 wp_nav_menu( array( 'theme_location' => 'primary' ) ); 150 ?> 151 </nav><!-- #access --> 152 </header><!-- #branding --> 153 154 155 <div id="main">
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Mon Jun 15 08:20:09 2026 | Cross-referenced by PHPXref |