Custom Header Images on Pages – Parallax Pro Theme

Here was the original request on SP forums:

I used Sridhar Katakam’s tutorial on relocating entry title headers but I want to make these headers images rather than text. The person who initial responded to my questions said this:

I amended the CSS to display scaling background images to create full width, applying the page-id-xx code in the CSS to define different images for each page.

Sam Bell

I am using Featured Image option for pages. So I added following code in functions.php file:

add_image_size( 'header-img', 9999, 250, TRUE ); // Resizing the uploaded image.
add_action('genesis_after_header', 'gd_site_banner', 25);
function gd_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;
}
This site uses cookies to offer you a better browsing experience. By browsing this website, you agree to our use of cookies.