This tutorial enables you to add a hero image with overlaying content behind your site header and nav menu like this :
Tested using the latest version of the Genesis Sample child theme by StudioPress, this solution works with or without Gutenberg blocks on the home page.
Demo Video
Shows a full screen width image behind the site header and menu in the Genesis Sample theme. Shows the image can be changed using the Hero Image setting in the customizer. Displays HTML content from the Hero Text widget area.
Installation Steps
There’s 4 steps :
- # Upload the files named front-page.php and hero.js to the your theme folder like this :
- # Copy & paste the PHP code from functions.php file to the end of your Genesis Sample themes functions file
- # Copy & paste the CSS from the style.css file to the end of your themes style sheet and clear caching.
- # From your WordPress Dashboard, go to Appearance > Widgets and copy the demo HTML for the hero text into a HTML widget in the Hero Text widget area.
Once you’ve completed the steps, you can then add a image using the customizer or upload an image file named hero.jpg directly to your child themes images folder.
I was previously using Layerslider, and it would display the full height of the image even on a mobile device, as you move up to larger screens, such as my desktop, the image would display more of the width, and if you rotate the screen to landscape proportions,m it would display the entire image.
How do I change CSS to display full height, the above doesn’t work on all proportions of screen? Thank you.
I don’t have the CSS for this as its something i would need to spend some time on to work out but it would involve modifying the default CSS i provided with new values in order to work with your new image size. I do provide limited PHP modification support included in membership at no additional charge however CSS modifications are either billable or something you will need to spend time on yourself.
Thanks, I did that, and it works up to about 90% full screen, then when I go full screen it cuts off the bottom of the image – it’s like it wants to do full width but not full height.
Hi, the default hero image size is 1600 x 800, how do I change this to accommodate a larger image, say 1920 x 1080? Thanks.
Link to your site please. You can change the values in the CSS.
Hi Brad, it’s https://loveweddingphotosandfilm.co.uk/
Ideally, I want to be able to add an image with the proportions of 6 x 4, thank you.
Try changing the value for the height in this CSS rule
Thanks. I already have this in my css file:
I tried changing height: 100% to height: 100vh; but the image still doesn’t display full height, it’s cropping the image when viewed on a desktop.
Add another rule after that one anc clear caching. It worked when i tested it in the browser.
ok! I will double check and make sure I did not mess up any code because it is not showing up transparent for me after uploading my logo
If you also want it transparent on scroll, add this CSS to the end of your style sheet and clear caching :
Not sure whats going on, but i followed the steps exactly and the image is not showing
I emailed you a copy of the text theme which includes the code installed. Did you add a widget to the widget area? Otherwise please send me FTP access.
Thanks for sending it! It is working perfectly now! 🙂
I’m sorry actually is there a way to make the header transparent when a logo image is present?
The site header is transparent when a logo is added using Customize > Site Identity > Logo