-
AuthorPosts
-
November 4, 2014 at 10:46 am #345799
Hey there,
I’m having problems when I share a post to a social (ie Facebook): the post preview seems to be correct (including its image), but when I check it on Facebook, I see another picture linked to the shared post.
Please have a try: http://www.eyleducation.it/il-re-e-morto-viva-il-re/Could you help me please?
Thanks in advance.November 4, 2014 at 12:51 pm #345830Hi HIO2014!
You need to make sure your featured image in your Post is the image you would like to set as the facebook shared image.
If such is the case, please forward us administrative credentials to your site for us to have a closer look.
Cheers!
ArvishNovember 4, 2014 at 1:34 pm #345839This reply has been marked as private.November 5, 2014 at 10:19 am #346418Hey there, is there any news? :)
November 5, 2014 at 8:25 pm #346735Hi!
Try adding this to the bottom of your /enfold/functions.php file,
add_action( 'wp_head', 'enfold_customization_add_facebook_open_graph_tag' ); function enfold_customization_add_facebook_open_graph_tag() { global $post; if ( is_single() && has_post_thumbnail() ) { echo '<meta property = "og:image" content = "'.get_the_post_thumbnail( $post->ID, 'full' ).'" />'; } }
Cheers!
ElliottNovember 6, 2014 at 9:59 am #347025Thanks for the reply.
If I add this to the functions.php file it doesn’t work.
I’ve tried to add the code to functions-enfold.php file and returns me this error (in the homepage too):Fatal error: Cannot redeclare enfold_customization_add_facebook_open_graph_tag() (previously declared in /web/htdocs/www.eyleducation.it/home/wp-content/themes/enfold/functions.php:502) in /web/htdocs/www.eyleducation.it/home/wp-content/themes/enfold/functions-enfold.php on line 1084
Any idea?
November 6, 2014 at 7:29 pm #347287Hey!
Please try changing the function name in Elliott’s code
add_action( 'wp_head', 'enfold_customization_add_facebook_open_graph_tag_new' ); function enfold_customization_add_facebook_open_graph_tag_new() { global $post; if ( is_single() && has_post_thumbnail() ) { echo '<meta property = "og:image" content = "'.get_the_post_thumbnail( $post->ID, 'full' ).'" />'; } }
Seems like it is declared already
Regards,
YigitNovember 7, 2014 at 3:44 pm #347765Thanks Yigit,
unfortunately it doesn’t work… :(
The image shared is always wrong…November 7, 2014 at 8:48 pm #347922Hi!
It appears to be working fine on my end.
Try clearing your browser cache and any caching related plugins you might have installed and try sharing it again.
Best regards,
ElliottNovember 10, 2014 at 10:12 am #348685The problem is not the preview…
Please have a look at the Facebook page once you have posted the article… it still shows the wrong image….November 11, 2014 at 11:48 am #349278Hey!
Please remove the code then use the WordPress SEO plugin. Go to SEO > Social then enable the Add Open Graph meta data setting.
Best regards,
IsmaelNovember 11, 2014 at 12:43 pm #349306Done, but it doesn’t work yet :(
I know I’m a pain in the a**, but the customer is begging me to solve this problem asap…Have a try, please
Something changed: there are two cases… the linked image is wrong, the linked image is blank…
- This reply was modified 10 years ago by HIO2014.
November 11, 2014 at 6:41 pm #349598Hey!
Hmm, I’m not sure. It appears to be grabbing the correct image but when you actually share the post a different one pops up. I checked your site in the facebook debugger and it says you should be explicitly setting the tags but when you check the scraper it’s obvious it should be seeing the tags. Maybe if we move the tags higher up in your header.
Is it only this post that is having the problem? Be sure to deactivate all plugins while testing.
Best regards,
Elliott- This reply was modified 10 years ago by Elliott.
November 12, 2014 at 2:30 pm #350005I have tried to deactivate all plugins and it still doesn’t work.
The problem appear for each article.Best regards.
November 13, 2014 at 4:43 pm #350710Hi!
I just tried it again and it’s grabbing the correct image now when the link is shared. Try clearing your browser cache and any caching related plugins you might have installed and try sharing it again.
Regards,
ElliottNovember 14, 2014 at 11:26 am #351185Thanks, now it works!
-
AuthorPosts
- The topic ‘Wrong image article when i share to social’ is closed to new replies.