[Resolved] hide featured image in single post

Home Forums Support [Resolved] hide featured image in single post

Home Forums Support hide featured image in single post

Viewing 8 posts - 16 through 23 (of 23 total)
  • Author
    Posts
  • #221550
    Bill

    Ok, I am still confused. I have both a post image and a featured image in each post.

    I need the featured image for the Recent Posts Widget Extended plugin.

    In order to not show both post image and featured image on a single post page, I use this css:

    .page-header-image-single {
    display: none;
    }

    I see that the image still loads but is just hidden? Won’t that affect load time?

    So, from what I am understanding, I should go ahead and just remove all of the post images so they use just the Featured image and use this css

    .page-header-image-single {
    text-align: center;
    }

    to center the Featured image in the single post?

    Thanks!

    #221602
    Tom
    Lead Developer
    Lead Developer

    Hi Bill,

    Both shouldn’t display.

    If the Page Header metabox has an image set, it will display that image.

    If not, it will display the featured image if it’s set.

    From the sounds of it, you would be better off just using the Featured Image metabox if you’re not using any of the more advanced settings of the Page Header metabox ๐Ÿ™‚

    #221947
    Bill

    Hi Tom.

    I am still having trouble with this.

    When I look at my blog page, both post image and feature image show unless I select “Hide” under the “Post Image” in the Customizer. Then just the post image shows and not the featured image. This part works great.

    When I look at a single post page, however, both the image within the post and featured image are showing. So, do I have to go into every post page and disable the “post image/page header” to keep the featured image from showing? Or hide them with css?

    I don’t want to use the featured image because it does not display the caption.

    I guess I am looking for a “Hide featured Image” by default button or something similar in the customizer.

    Thanks again!

    #221986
    Tom
    Lead Developer
    Lead Developer

    Ah I understand, you’re using the same image inside the content and as your featured image.

    Using display: none is the easy solution – I don’t think having elements hidden affects load time, but I can’t tell you for sure.

    You might be able to use a function like this:

    add_action( 'after_setup_theme','generate_remove_single_featured_images' );
    function generate_remove_single_featured_images()
    {
        remove_action('generate_before_content','generate_featured_page_header_inside_single', 10);
        remove_action('generate_before_content','generate_page_header_single', 10);
        remove_action('generate_after_entry_header','generate_page_header_single_below_title', 10);
        remove_action('generate_after_header','generate_page_header_single_above', 10);
    }
    #222012
    Bill

    Thanks Tom!

    That worked perfectly! I put it in child’s functions.php.

    The Recent Posts Extended plugin was also able to pull in the featured images for the thumbnails.

    All is well!

    #222031
    Tom
    Lead Developer
    Lead Developer

    Awesome, glad I could help ๐Ÿ™‚

    #1462932
    impro1

    Hi Tom, is this feature implemented in GP premium?
    I want to hide the featured image in a single post page.

    #1462944
    Elvin
    Staff
    Customer Support

    Hi Gautam,

    Hi Tom, is this feature implemented in GP premium?
    I want to hide the featured image in a single post page.

    Yes this is a feature implemented in GP Premium.
    https://docs.generatepress.com/article/adjusting-the-featured-images/

    Feel free to open a new topic for further questions. Thanks.

Viewing 8 posts - 16 through 23 (of 23 total)
  • You must be logged in to reply to this topic.