Site logo

[Resolved] is it possible to pin the featured image to the bottom left of the page

Home Forums Support [Resolved] is it possible to pin the featured image to the bottom left of the page

Home Forums Support is it possible to pin the featured image to the bottom left of the page

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #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' ); to add_action( 'generate_after_before_footer', 'generate_post_image' ); but got no joy. still not great with php.

    thanks for your wisdom.

    🙂

    #2437762
    Leo
    Staff
    Customer Support

    Hi 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-information

    Let me know 🙂

    #2439923
    sparkle

    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)…

    #2440063
    Ying
    Staff
    Customer Support

    Can 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 thebefore_footer hook, add a GB image block, enable its dynamic data option, and set it to the featured image.

    #2441356
    sparkle

    hm. i’ve not really used blocks elements. here is their sketch.

    #2441370
    David
    Staff
    Customer Support

    Hi 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 ?

    #2441593
    sparkle

    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.

    #2441602
    David
    Staff
    Customer Support

    Ok, so simple solution would be to:

    1. Create a Block Element – Hook.
    2. Set the Hook to before_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.

    #2441608
    sparkle

    hm. not using generateblocks yet. can i put some php code in the hook? i’m such a slow adopter!

    #2441632
    David
    Staff
    Customer Support

    Like 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-thumbnail will 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-image which you can use for styling if needed.

    For ref:
    https://developer.wordpress.org/reference/functions/get_the_post_thumbnail/

    #2452213
    sparkle

    ah! thank you!

    #2452754
    David
    Staff
    Customer Support

    You’re welcome – let us know if you need assistance with positioning 🙂

    #2580788
    sparkle

    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!

    #2581069
    Ying
    Staff
    Customer Support

    Try this CSS:

    body > a[title^='Lewiston Auburn Senior College'] {
        z-index: 1;
        position: relative;
    }
    
    body > .site {
        z-index: 2;
        position: relative;
    }
    #2583869
    sparkle

    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.

    🙂

Viewing 15 posts - 1 through 15 (of 18 total)
  • You must be logged in to reply to this topic.