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