- This topic has 22 replies, 4 voices, and was last updated 5 years, 5 months ago by Kelly.
November 30, 2016 at 2:17 am #249642Jiri
I have a blog page with image gallery and i would like to use the featured image as a header image, which is shown over the whole fullscreen (aka cover). A normal header image hasn’t this option, so i tried to use the section and set the background image to the featured image. Of course this doesn’t work, because there is no content in this section.
Is there any css trick, how to show the whole background image, no matter there is no content, in this section?
Or maybe another way, how to set the header image to “cover” the fullscreen?
Thanks in advance for you reply!
Best regards JiriNovember 30, 2016 at 3:12 am #249659Richard Bland
Thanks for reaching out.
I have done a similar thing in the past for the blog page.
What I did is to setup a GP Hook ‘After Header’ and put in my own conditional statement to only show a featured image on the blog page, see below.
<?php if ( is_home()||is_single() ) : ?> FEATURED IMAGE <?php endif; ?>
Then I simply created my own div container where it says FEATURED IMAGE and put in my image and content there, then added the custom CSS to create a full width, responsive image.
You could also use a plugin to put in say a slider using shortcodes, so this conditional statement is quite useful.
I hope this helps you along the way.
--November 30, 2016 at 3:55 am #249674Jiri
Thanks for your reply. May i ask, where exactly did you create your own div container?
Directly on the post page or somewhere in the code?
Thank you for the explanation!
Best regards JiriNovember 30, 2016 at 4:00 am #249675Richard Bland
I would do it within the code so as a very simple way of doing this for example:
<?php if ( is_home()||is_single() ) : ?> <div class="blog-featured-image"> <img src="path-to-image-url" /> </div> <?php endif; ?>
The beauty of this is that you have total control of the content you put in there. You could create a div container with the image as the background, and then have some <h1> tags in there so they float over the image. You can get quite creative with this approach.
--November 30, 2016 at 4:05 am #249676Jiri
Thank you for your super fast reply and example!
I will try it!
Have a nice day!
JiriNovember 30, 2016 at 4:16 am #249677Richard Bland
I have an honest mistake to admit – in the latest version of GP Premium, you can in fact add in a page header just for the blog using the customiser.
Follow these steps:
1. Open customiser
2. Go to Blog and make sure you are on the blog page
3. You should now see options for ‘Page Header Image’ and ‘Page Header Content’
4. Add in your page header image
5. Now in the page header content, add in the content you wish to use to the text box, this will reveal additional options as you do so
6. Now ‘Enable Image Background’
7. Now ‘Enable Full Screen’
8. Choose ‘Enable Vertical Center’
9. Choose ‘Container Type Full Width’
10. Choose ‘Text Align Center’
This will enable the full width page header with background image!
If you do not want it to show full screen, disable that option and then play around with the ‘Padding’ settings at the bottom of the options to increase the height of the background image.
Sorry for not remembering this method…
--November 30, 2016 at 4:37 am #249680Jiri
Unfortunately this option doesn’t work for me. I have the latest version of GP Premium, but there is no change, when i define the image for the header in customizer.
I will try it through the hooks ..
JiriNovember 30, 2016 at 4:40 am #249682Richard Bland
That is an odd one. If you would like me to check your settings for you, please do email me again with a user login.
In order to see those settings via customiser you must be viewing the blog page in customiser and you must have some text or something in the content box. If you don’t none of the additional options appear.
Email me and when I get some spare time I can look for you.
Failing that, my first solution will definitely give you the ability to add in a featured image. You will just need to style it to your liking.
--November 30, 2016 at 4:45 am #249684Jiri
Thank you very much for your patience!
I have created an admin user for you, so you should get an email with your login.
It would be great, if you can check it, but it’s nothing important, so no hurry.
JiriNovember 30, 2016 at 8:30 am #249783Richard Bland
I have updated your settings to allow for a full width image to be used above your blog posts on our blog page.
You can adjust the padding settings to change the height of the image being used, and of course you can change the image. You will need to put some content in the content box, taking that content out will result in the header image not being visible correctly.
I hope this has helped you, please confirm if this has resolved your issue.
--November 30, 2016 at 1:49 pm #249932Jiri
Thank you very much for your time! It works exactly, as you describe. The problem is my wrong description. I wrote ‘blog page’, but i thought ‘post page’ 🙁
I’m really sorry for this mistake and your wasted effort.
I will try your idea with hooks.
JiriNovember 30, 2016 at 1:54 pm #249934TomLead DeveloperLead DeveloperNovember 30, 2016 at 1:59 pm #249937Jiri
Thanks for your idea, but in the meta box is not possible to define ‘cover’ option, isn’t it?
I have to say, that my ‘post page’ is ‘boxed’ … but i would like to have a header image on full width of the page.November 30, 2016 at 2:00 pm #249938TomLead DeveloperLead Developer
It has all of the same options, you just need to add content to the “Content” tab in the meta box in order to reveal all of the options: https://generatepress.com/knowledgebase/generate-page-header/November 30, 2016 at 2:06 pm #249943Jiri
Oh, i see it now!
Really, really thank you for you patience and amazing support!
- You must be logged in to reply to this topic.