Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #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.

    #345830

    Hi 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!
    Arvish

    #345839
    This reply has been marked as private.
    #346418

    Hey there, is there any news? :)

    #346735

    Hi!

    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!
    Elliott

    #347025

    Thanks 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?

    #347287

    Hey!

    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,
    Yigit

    #347765

    Thanks Yigit,
    unfortunately it doesn’t work… :(
    The image shared is always wrong…

    #347922

    Hi!

    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,
    Elliott

    #348685

    The 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….

    #349278

    Hey!

    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,
    Ismael

    #349306

    Done, 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.
    #349598

    Hey!

    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.
    #350005

    I have tried to deactivate all plugins and it still doesn’t work.
    The problem appear for each article.

    Best regards.

    #350710

    Hi!

    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,
    Elliott

    #351185

    Thanks, now it works!

Viewing 16 posts - 1 through 16 (of 16 total)
  • The topic ‘Wrong image article when i share to social’ is closed to new replies.