[Support request] featured image

Home Forums Support [Support request] featured image

Home Forums Support featured image

  • This topic has 11 replies, 3 voices, and was last updated 7 years ago by Tom.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #377439
    Marcin

    Hello!
    I set the featured image size to 353×235, but on mobile it looks bad.
    It is possible to set the size of featured images on mobile version to “auto”?

    website: http://marcinszkodzinski.pl (See the home page on your smartphone)

    #377500
    Tom
    Lead Developer
    Lead Developer

    The best thing to do is set your image to as wide as it needs to be on mobile, then do any resizing using CSS on desktop. Images can be sized down, but not up.

    Let me know if you need more info πŸ™‚

    #377530
    Marcin

    I’m not sure I understand. πŸ™‚

    #377585
    Leo
    Staff
    Customer Support

    What would like to happen on mobile? It looks fine to me?

    #377736
    Marcin

    Horizontal position. πŸ™‚

    #377881
    Tom
    Lead Developer
    Lead Developer

    Basically, make your image larger than it currently is, so it looks good on mobile.

    Then use CSS for desktop to make it smaller:

    @media (min-width: 769px) {
        .post-image img {
            max-width: 250px;
        }
    }
    #378440
    Marcin

    Ok, thanks.
    My page is almost ready.
    The last question:
    How to remove “page header” on mobile devices? The whole picture on the screen looks bad.
    I want it to be just a picture before content
    I hope you understand πŸ™‚
    It’s a foreign language for me. πŸ™‚

    #378541
    Leo
    Staff
    Customer Support

    Since you are not adding contents in page header, try uploading it as featured images instead: https://docs.generatepress.com/article/adding-featured-images/

    Let me know if this works for you.

    #378648
    Marcin

    On my page, the featured image it’s the “page header”. On mobile devices, this looks bad, so I would like this to be a normal image.
    It means:
    On computers, the featured image is in accordance with the settings of the page header.
    On mobile devices, featured image is…a normal featured image.
    Is it possible?

    #379247
    Tom
    Lead Developer
    Lead Developer

    Would you like it to appear in the exact same spot as the current Page Header? So basically just a static image to replace the current Page Header background image?

    #379329
    Marcin

    Yes.

    #379778
    Tom
    Lead Developer
    Lead Developer

    First, add this CSS:

    @media (max-width: 768px) {
        .page-header-content {
            display: none;
        }
    }

    Then, add this PHP:

    add_action( 'generate_after_header', 'tu_add_static_featured_image' );
    function tu_add_static_featured_image() {
        if ( is_singular() ) {
            echo '<div class="hide-on-desktop hide-on-tablet">';
                the_post_thumbnail();
            echo '</div>';
        }
    }
Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.