Archived topic
Featured image is not displayed on single post page
11 replies · Started by Dave on March 20, 2018
The featured image is working fine on with front page list, but not on the single post item. The “Disable Elements” feature is not activated. The box is checked to “Display featured images” in the customizer under layout/blog/featured image on the post tab.
Thanks for any help
Hi there,
Looks like you've figured out? I can see the featured image no problem:
http://www.screencast.com/t/9HuIcsFiO
Hi Leo,
The issue is not corrected yet. The screen grab you show doesn't have the featured image. If you go to the home page, the featured images are displaying in the list of post correctly. But when you click the link to the single post the featured images are not displaying on the single page. This is the issue.
Thanks,
Dave
Are you wanting to use featured image and page header at the same time?
Yes, I want to page header, the post title, the featured image, and then the post text. I have the "display feature images" checked in the customizer, blog, layout for post area. If you go to the home page the header featured images displays fine, but if you click the post to load a single post the featured image is not displayed but I would like it there also.
Thanks,
Dave
Right now the Page Header replaces the featured image on single posts and pages. We're working on separating the two so they can be displayed at the same time.
For now, you can do something like this: https://generatepress.com/forums/topic/featured-image-does-not-appears-in-indivual-post/page/2/#post-525114
Let me know if this helps or not :)
Hi Tom,
Thanks for your speedy response on a Sunday evening. I'm impressed. I tried using the code (below) in the "additional CSS area of the customizer, but it was showing 6 errors and I wasn't able to save it. Then I tried using a child theme and added the code to the style.css file. It did nothing.
If you working on the better solution in the works, I guess I can wait. But if you have another suggestion using css please let me know.
Thanks,
Dave
add_action( 'generate_after_content', 'tu_add_featured_image' );
function tu_add_featured_image() {
if ( has_post_thumbnail() && is_singular() ) {
the_post_thumbnail();
}
}
That's PHP code so try one of these methods: https://docs.generatepress.com/article/adding-php/
Code snippets is the easiest if you aren't using a child theme.
Hi Leo,
Yes, the code is working. Thank you. I would like one adjustment if possible. Could the featured image be inserted after the title and before the text of the post ( on the single post page only)? So the elements on the single post page would be the header, the post title, the date, the featured image, and then the post text.
If there is an easy fix I would be very happy. I'm happy now just to have the featured image on the post page.
Thanks again,
Dave
Absolutely! Instead of:
add_action( 'generate_after_content', 'tu_add_featured_image' );
Do this:
add_action( 'generate_after_entry_header', 'tu_add_featured_image' );
Hi Tom,
Thank you, Thank you. Your code change is exactly what I wanted. Great theme and great support! I'm glad I purchased the upgrade to Premium.
Dave
Thanks! Glad I could help :)