- This topic has 17 replies, 4 voices, and was last updated 2 years, 11 months ago by
Ying.
-
AuthorPosts
-
November 27, 2022 at 10:04 am #2437536
sparkle
hi there,
a site i’m working on has a design that shows the featured image for the page pinned to the bottom left, beside the content, on top of the footer. is there a way to do this either with gp elements or in a child theme? i tried hamhandedly adjusting the action in /inc/structure/featured-images.php from
add_action( 'generate_after_entry_header', 'generate_post_image' );toadd_action( 'generate_after_before_footer', 'generate_post_image' );but got no joy. still not great with php.thanks for your wisdom.
🙂
November 27, 2022 at 12:45 pm #2437762Leo
StaffCustomer SupportHi there,
Any chance you can link us to the page in question?
You can use the private information field:
https://docs.generatepress.com/article/using-the-premium-support-forum/#private-informationLet me know 🙂
November 28, 2022 at 2:34 pm #2439923sparkle
sure… thanks. they want the rounded cutout image currently set as featured to the left edge of the browser at the top of the footer. (i know i’ll have some fiddling to do with the margins, mobile layout, etc)…
November 28, 2022 at 4:20 pm #2440063Ying
StaffCustomer SupportCan you show us a mockup?
Having a hard time imagining what it would look like.
If you just want to change the position of the featured image, you can disable the featured image for single post at customizer > layout > blog.
Then add a block element using the
before_footerhook, add a GB image block, enable its dynamic data option, and set it to the featured image.November 29, 2022 at 8:30 am #2441356sparkle
hm. i’ve not really used blocks elements. here is their sketch.
November 29, 2022 at 8:34 am #2441370David
StaffCustomer SupportHi there,
can i just clarify:
1. The image will be fixed to the viewport – so it will not scroll out of view?
2. The content beside the image, will that be scrollable ? – i assume Yes, if Yes to #1
3. And this would be for ALL pages?
4. And what happens to it on mobile ?November 29, 2022 at 10:32 am #2441593sparkle
1. no the image would be at the bottom of the page above the footer, no matter the length of the content.
2. not scrollable.
3. yes, all pages with a featured image.
4. i bet we hide the background image.November 29, 2022 at 10:38 am #2441602David
StaffCustomer SupportOk, so simple solution would be to:
1. Create a Block Element – Hook.
2. Set the Hook tobefore_footer
3. Add a GB Image Block and enable its Dynamic Data and set the source to Current Post and the Content to Featured Image.
4. Set the Display Rules to where you require it.The block will only output the Image if one exists.
It may require some tweaking but if you want to start there.
let me know.
November 29, 2022 at 10:42 am #2441608sparkle
hm. not using generateblocks yet. can i put some php code in the hook? i’m such a slow adopter!
November 29, 2022 at 10:55 am #2441632David
StaffCustomer SupportLike this:
<?php if ( has_post_thumbnail() ){ global $post; echo get_the_post_thumbnail($post->ID, 'post-thumbnail', array( 'class' => 'footer-featured-image attachment-post-thumbnail size-post-thumbnail' ) ); } ?>The
post-thumbnailwill output the standard src-set sizes, you can change that if you want specific attachment.
And i added a custom class to the class array of:footer-featured-imagewhich you can use for styling if needed.For ref:
https://developer.wordpress.org/reference/functions/get_the_post_thumbnail/December 6, 2022 at 4:35 pm #2452213sparkle
ah! thank you!
December 7, 2022 at 3:37 am #2452754David
StaffCustomer SupportYou’re welcome – let us know if you need assistance with positioning 🙂
March 24, 2023 at 10:17 am #2580788sparkle
i’ve come back to this project and i’m so close to having what i want… but i’m having zindex issues, i think. how can i get the featured image we moored to the bottom to sit behind the content on the page?
thank you!
March 24, 2023 at 4:37 pm #2581069Ying
StaffCustomer SupportTry this CSS:
body > a[title^='Lewiston Auburn Senior College'] { z-index: 1; position: relative; } body > .site { z-index: 2; position: relative; }March 27, 2023 at 4:47 am #2583869sparkle
ahh… yes. perfection. thank you. tho…. i don’t understand the first line of the code… is it looking at that page title only? it seems to work for all of the pages, which is great and what i want.
🙂
-
AuthorPosts
- You must be logged in to reply to this topic.