Updated on March 11, 2018
In the past, I covered Featured image below header on Pages and Posts with entry header overlay in Infinity Pro.
In this tutorial, we shall implement the same in Monochrome Pro's single posts and static Pages i.e., show featured image below the site header and overlay entry header (title on Pages and title + post info on posts) centered.
It should be noted that the image is NOT a background and is inserted/embedded and hence is naturally responsive.
Sample single post:
Sample static Page:
At smaller widths, entry header will be set to appear below the image.
Tested in Monochrome Pro 1.0.
Step 1
Add the following in child theme's functions.php:
// Register a custom image size for hero image on static Pages and single Posts.
add_image_size( 'page-header', 1600, 400, true );
Step 2
Create a file named say, template-pageheader.php in the Monochrome's directory having the following:
To view the full content, please sign up for the membership.
Already a member? Log in below or here.
This is awesome Sridhar! Thanks for your help.
I’m already using the code you wrote to add a Soliloquy slider to Monochrome Pro. Does any of this conflict with the Soliloquy slider code? I just wanted to check before I implement it. Thanks again for all your efforts!
It should not.
What do I need to modify if I want the entry header below the image at ALL widths?
Also, if I want the header image to be taller than 400 px, do I simply modify this code in the functions.php file?
// Register a custom image size for hero image on static Pages and single Posts.
add_image_size( ‘page-header’, 1600, 400, true );
Thanks!
1) Delete js/single.post.js
2) Replace all the code in template-pageheader.php with
3) Replace the code to be added in style.css with
Yes.
Hey Sridhar, on an iPhone 6, the featured image is moving under the header in portrait mode. Landscape mode is fine. Please advise. Thanks!
Please note that I’m talking about the original code, not the modified code you just added.
In style.css change
to
Worked great! Thanks!
Hi Sridhar,
Great tutorial. Is there a way to make the entry header appear over the image even at smaller widths ?
Thank you.
I was also wondering how you would modify your ‘Transparent Site Header in Monochrome Pro’ tutorial to work with this tutorial.
Hey Sridhar, when you get a chance can you check your code at various browser widths. For some reason, the h1 entry-title under the .entry-header element is not left aligned with the body copy at some browser widths. I tried modifying the margin, but I can’t get it to work. Please advise. Thanks!
I have updated the code in Step 6 to fix this.
Hey Sridhar, that didn’t work. I think the problem is I’m using a content left, sidebar right layout for my pages. How can I send you a private message with the URL of the site I’m working on so you can see what’s going . on? Thanks!
Send me the URL via https://sridharkatakam.com/contact with a URL of this tutorial/comment.
Okay, sent. Thanks!
Very useful thank you. Quick question if i use a page with the above featured image as the home page, the image does not appear its just styled as a normal page. Is there a simple solution to make it work on home page. Many thanks