Last active
August 29, 2015 14:15
-
-
Save chrismhobson/d45e6d7b61e726fe5ac6 to your computer and use it in GitHub Desktop.
Genesis - Add Full-width Responsive Header Images to Pages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//* 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