Support › Forums › Flex Theme › Featured image isn’t showing on individual blog posts
- This topic has 12 replies, 3 voices, and was last updated 4 years, 3 months ago by
Chinmoy Paul.
-
AuthorPosts
-
July 28, 2016 at 4:05 pm #1142
Sherry Sink
ParticipantHi –
We revamped our client’s website and now we notice that the featured image isn’t showing up at the top of their blog posts. It shows up on the overall blog page that shows all posts, but when you click on an individual post, the featured image doesn’t display at the top of the post.
Is there a setting we’re missing to get the image to show up?
Thanks for your time and help!
July 29, 2016 at 2:21 am #1143Chinmoy Paul
ModeratorAdd this in your functions.php file
add_action('genesis_entry_header', 'flex_single_post_image', 4 ); function flex_single_post_image() { if( ! is_singular( 'post' ) ) return; add_action('genesis_entry_header', 'genesis_do_post_image', 4 ); }
is_singular( ‘post’ ) is checking that you are on single post page. Returning early if you are not there and next line of code will not execute. I used the “genesis_entry_header” hook and set the priority 4. So your featured image will appear above the post title.
July 29, 2016 at 4:10 am #1146Sherry Sink
ParticipantHi –
I tried to add that code to Dashboard > Appearance > Editor > functions.php, but when I clicked save, it just whited out the screen. And when I refreshed my blog page, the page whited out as well. I’m guessing there’s something missing or off about the code?
Or do I need to put it in a very specific place within the functions php file?
Thanks again for your help!
July 29, 2016 at 9:07 am #1147Chinmoy Paul
ModeratorAre you add the code at bottom of the file? If you share the FTP details via our contact page then I can help you.
July 29, 2016 at 5:15 pm #1148Sherry Sink
ParticipantI didn’t add it to the very bottom of the file – I had tried to add it to a different area.
So I went back in and added it to the very bottom of the file and it did allow me to save it without whiting out the screen. However, the featured image still doesn’t show up on the individual blog page. It’s just text showing.
Which is weird because the featured images show up on the overall blog page as the thumbnails, so I know each post has a featured image set. They’re just not showing up when you click to view the individual blog post.
Do I need to add additional code, or was the functions.php code you provided the only code that was needed to get the featured image to display on single blog posts?
Thanks again!
August 3, 2016 at 12:57 am #1150Sherry Sink
ParticipantHi – just checking in to see if you got my last message?
I was able to save the code to the bottom of the functions.php page as you recommended, but the featured image is still not showing up on the top of the individual blog posts.
What am I missing? What else do I need to do to get your code to work?
Thank you very much for your time and help.
August 3, 2016 at 2:11 am #1151Chinmoy Paul
ModeratorCan you share the wp-admin access via our contact page?
August 3, 2016 at 6:32 am #1153Chinmoy Paul
ModeratorExtremely Sorry! Above code is wrong. Here is the correct one:
add_action('genesis_entry_header', 'flex_single_post_image', 4 ); function flex_single_post_image() { if( ! is_singular( 'post' ) ) return; $img = genesis_get_image( array( 'format' => 'html', 'size' => 'large', 'context' => 'archive', 'attr' => genesis_parse_attr( 'entry-image', array ( 'alt' => get_the_title() ) ), ) ); if ( ! empty( $img ) ) { echo $img; } }
-
This reply was modified 4 years, 5 months ago by
Chinmoy Paul.
August 3, 2016 at 3:39 pm #1155Sherry Sink
ParticipantIt worked! Thank you very much!
October 10, 2016 at 11:00 pm #1370JayneCorner
ParticipantHi! I am having the same issue but with the Sunshine theme – I would like the featured image of each blog post to appear at the top of each individual post.
Could you tell me what I’d need to change to the code to make it Sunshine specific please? And also where to put the code.
Thank you!
October 11, 2016 at 2:56 am #1371Chinmoy Paul
Moderator@JayneCorner can you open a new thread under Sunshine tropic section?
October 12, 2016 at 3:40 am #1374JayneCorner
ParticipantHi there!
I have implemented the code as you sent me – but the image is showing as a thumbnail and it’s not UNDER the title, but ABOVE the blog post title. Implementing that code is also creating a duplicated image in the blog archive page.
I’d like it to appear as per the example here: http://demo.simpleprothemes.com/sunshine/2015/03/04/this-is-a-featured-post-2/
Interestingly I updated the genesis settings in the ‘content archives’ to “large” instead of “thumbnail” – and the image then appears full size in the blog article (still above the title) BUT then my blog archives are showing duplicate large images. (which isn’t what I want).
Is this something which can be fixed with a code or do I need to manually insert an image at the top of each post instead?
Thank you
Jayne
October 12, 2016 at 5:00 am #1375Chinmoy Paul
ModeratorDemo site is adding the image in WP Editor. We are not using any Code for it. It is just a sample of single blog post.
If you want to avoid the manual process then you will add the above code.
Can you share the wp-admin access via contact form?
-
This reply was modified 4 years, 5 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.