Archived topic
hide featured image in single post
22 replies · Started by Carlotta Gergely on October 16, 2014
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!
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 :)
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!
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);
}
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!
Awesome, glad I could help :)
Hi Tom, is this feature implemented in GP premium?
I want to hide the featured image in a single post page.
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.