• If I share a product of page on Facebook or Twitter, the image thumbnail shows, however if I share any blog post it the image thumbnail does not show. I have tried several plugins to resolve this but unfortunately nothing has worked out yet. I will be glad to get help regarding this issue. Thanks!

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello @akinleyeajayi,

    I have check your blog post and I don’t find any meta property like below which is necessary to add in your header section. Please add below in your header section with the appropriate value.

    <meta property=’og:url’ content=”/>
    <meta property=’og:type’ content=”/>
    <meta property=’og:title’ content=”/>
    <meta property=’og:image’ content=”/>
    <meta property=’og:description’ content=”/>

    After adding these, You can re-fetch and check in facebook developer debug tool:
    https://developers.facebook.com/tools/debug/

    Thanks,

    Thread Starter akinleyeajayi

    (@akinleyeajayi)

    Thank you Jaydeep. I appreciate your response. What I will really love to achieve is not to add this per post…. If there is a way I can add this to maybe my Theme Header header.php (under the <head> or maybe theme Function…. So the thumbnail image is taken from the “Featured Image”….. So I don’t have to add this to all post as It works out of the box for products and pages. Cheers Jaydeep.

    Hi,

    I understand. Are you using Yoast SEO plugin? If Yes, then you can set up it through it from the Backend.

    It might be helpful to you below link:

    https://www.google.co.in/amp/s/kb.yoast.com/kb/custom-open-graph-tags/amp/

    Thanks,

    Thread Starter akinleyeajayi

    (@akinleyeajayi)

    Hello,
    Yes I am using the Yoast plugin. It has always been working but it just stopped working. I have tried multiple things before coming on here but no luck. Thanks again Jaydeep.

    Hello @akinleyeajayi

    If Yoast plugin is not working then you can try with a custom code to add a meta image for facebook share.

    Here is the code that you can copy and paste into your theme’s functions.php file.

    
    function insert_og_image_in_head() {
        global $post;
        if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image
            $default_image= get_template_directory_uri()."/images/defaultshareimage.jpg"; //replace this with a default image on your server or an image in your media library
            echo '<meta property="og:image" content="' . $default_image . '"/>';
        }
        else{
            $thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' );
            echo '<meta property="og:image" content="' . esc_attr( $thumbnail_src[0] ) . '"/>';
        }
    }
    add_action( 'wp_head', 'insert_og_image_in_head', 5 );

    This will help you. also let me know if you have still issue or not getting anything in this.

    Thread Starter akinleyeajayi

    (@akinleyeajayi)

    Hello there @jaydeep, thank you for trying again. I used the code in my functions.php and it still did not work for Facebook or Twitter. I am wondering what the problem could be. This is very strange as it works perfectly for when sharing a page or a product but once it is a blog post then it doesn’t work.

    Hi:
    I’ve been trying out some “light” social share plugins for my blog.
    I’ve noticed ( correct me if I’m wrong) but it appears that ONLY CERTAIN plugins show my POST image thumbnail when shared to say, twitter; many don’t. Is this part of the plugin design or is their something afoul on my site??
    Thanks
    Howard

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Image thumbnail not showing for social sharing of posts’ is closed to new replies.