Skip to content

Instantly share code, notes, and snippets.

@chrismhobson
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrismhobson/d45e6d7b61e726fe5ac6 to your computer and use it in GitHub Desktop.
Save chrismhobson/d45e6d7b61e726fe5ac6 to your computer and use it in GitHub Desktop.
Genesis - Add Full-width Responsive Header Images to Pages
//* Add Responsive Header Images to Pages
add_image_size( 'header-img', 9999, 250, TRUE ); /*remove '250' and true for unlimited height*/
add_action('genesis_after_header', 'site_banner', 25);
function site_banner(){
if( !is_singular('page') )
return;
if( has_post_thumbnail() && is_page() ) :
$ftbanner = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'header-img' );
$banner = $ftbanner[0];
echo '<div id="site-banner" class="site-banner">' . "\n";
echo '<img src="' . $banner . '">' . "\n";
echo '</div>' . "\n";
endif;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment