- This topic has 16 replies, 3 voices, and was last updated 5 years, 6 months ago by David.
-
AuthorPosts
-
October 22, 2018 at 7:44 am #707219Ivan Cazorla
Hi there, is it possible to show an element header background photo after the post blog title, instead of shoing it before?
I’ve also tried to create 2 element headers (one with a photo and another one with the title), but they never show together when activated.
Let me know.
October 22, 2018 at 7:45 am #707222Ivan CazorlaLike this draw: https://snag.gy/x7svl5.jpg
October 22, 2018 at 7:47 am #707225LeoStaffCustomer SupportHi there,
Wouldn’t that just a be feature images below title?
https://docs.generatepress.com/article/adjusting-the-featured-images/Otherwise I guess you could try inserting the title first using the template tags:
https://docs.generatepress.com/article/page-header-template-tags/#post_titleThen adding a static image after that.
Let me know if this helps 🙂
October 22, 2018 at 7:54 am #707336Ivan CazorlaIt wouldn’t work as feature image below title because I want it to be full screen, therefore the max width is the container width.
So I would create one page header with: {{post_title}}
And then another page header with just the background image? Or a manual static image inside the post? Or where?
thanks,
IvanOctober 22, 2018 at 8:02 am #707350LeoStaffCustomer SupportManual static image inside the page hero content after template tag.
October 22, 2018 at 8:12 am #707363Ivan CazorlaSo that means I would have to create one new element header for every post with his own image inside?
October 22, 2018 at 8:18 am #707373Ivan CazorlaIf I do it like this:
<h1> {{post_title}} </h1> <img src="https://newdeacampada.campingsport.es/wp-content/uploads/2018/10/featured_corduroy_iron_and_resin_banner_photo.jpg">
The image shows inside the container and not in full width.
October 22, 2018 at 8:25 am #707391LeoStaffCustomer SupportI’ll check with Tom to see if there is a good way to do a full width featured image below the title as it will break the content container.
Also the image isn’t full width because your original image is 1170px in width and isn’t big enough to be full width.
October 22, 2018 at 8:27 am #707394Ivan CazorlaAlright thanks Leo, keep me updated.
Besides that, I thik you can make a photo cover the entire screen even if its width its not big enough, isn’t it?
thanks!
October 22, 2018 at 9:13 am #707420DavidStaffCustomer SupportHi there,
try this, create your Header Element and add your title etc. No background image.
Then new Hook Element > after_header hook, execute PHP checked and priority of 15 then add this for its content:<?php global $post; $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' ); ?> <div id="post" class="feat-image" style="background-image: url('<?php echo $thumb['0'];?>')"><!-- featured image --></div>
Then try this CSS:
.feat-image { padding-top: 56%; /* Adjust to match image aspect ratio */ background-size: cover; background-repeat: no-repeat; }
October 22, 2018 at 3:13 pm #707610Ivan CazorlaWoah! it worked like a champ!! thanks!!
October 23, 2018 at 1:57 am #707890Ivan CazorlaAnd is it possible to make the image show at its original width instead of fixing it to a certain padding width?
thanks,
October 23, 2018 at 4:57 am #707990DavidStaffCustomer SupportThat’s great. So the image you want displayed at full image size? Which would mean it wouldn’t be full width on larger screens?
October 23, 2018 at 7:21 am #708092Ivan CazorlaOh I didn’t realised that. Maybe its better to leave it as it is now.
thanks
October 23, 2018 at 8:17 am #708249DavidStaffCustomer SupportTrick is to set the padding % to match the images aspect ratio. Then if all images are the same ratio they should display 100% of the image on all screen sizes.
-
AuthorPosts
- You must be logged in to reply to this topic.