Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Incorporated the custom header image check from TwentyEleven's header…

….php file so that when the header image is removed (via the normal WP admin back-end), Whiteboard doesn't force a broken image tag into the page flow.
  • Loading branch information...
commit 3a6d7d8e3af1f88e37323babbca8a4bfcee729b3 1 parent 189c99e
Darren Slatten dslatten authored

Showing 1 changed file with 20 additions and 3 deletions. Show diff stats Hide diff stats

  1. +20 3 whiteboard/header.php
23 whiteboard/header.php
@@ -54,9 +54,26 @@
54 54 <h3 id="tagline"><?php bloginfo('description'); ?></h3>
55 55 <?php } ?>
56 56 </div><!--#title-->
57   - <div id="header-image" class="container">
58   - <img src="<?php header_image(); ?>" alt="<?php bloginfo('name'); ?>" />
59   - </div><!--#header-image-->
  57 + <?php
  58 + // Check to see if the header image has been removed
  59 + $header_image = get_header_image();
  60 + if ( ! empty( $header_image ) ) :
  61 + ?>
  62 + <?php
  63 + // The header image
  64 + // Check if this is a post or page, if it has a thumbnail, and if it's a big one
  65 + if ( is_singular() &&
  66 + has_post_thumbnail( $post->ID ) &&
  67 + ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( HEADER_IMAGE_WIDTH, HEADER_IMAGE_WIDTH ) ) ) &&
  68 + $image[1] >= HEADER_IMAGE_WIDTH ) :
  69 + // Houston, we have a new header image!
  70 + echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
  71 + else : ?>
  72 + <div id="header-image" class="container">
  73 + <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="<?php bloginfo('name'); ?>" />
  74 + </div><!--#header-image-->
  75 + <?php endif; // end check for featured image or standard header ?>
  76 + <?php endif; // end check for removed header image ?>
60 77 <div id="nav-primary" class="nav"><nav>
61 78 <?php if ( is_user_logged_in() ) {
62 79 wp_nav_menu( array( 'theme_location' => 'logged-in-menu' ) ); /* if the visitor is logged in, this primary navigation will be displayed */

0 comments on commit 3a6d7d8

Please sign in to comment.
Something went wrong with that request. Please try again.