I spent a good part of my weekend trying and trying to get shared links to show something, anything other than the icons in the right column as thumbnails. After countless widget downloads, snippet pasting, and failed cold coding… I finally did it! Well, me and my friend Google Search. And to think all it took was:

<!-- Start of Facebook Meta Tags by shailan (http://shailan.com) -->
    <meta property="og:title" content="Introducing dropdown menu effects" />
    <meta property="og:type" content="article" />
    <meta property="og:url" content="http://shailan.com/introducing-dropdown-menu-effects/" />
    <meta property="og:image" content="http://shailan.com/wp-content/uploads/wp-dropdown-menu-effects-thumbnail-200x200.jpg" />
    <meta property="og:site_name" content="shailan.com"/>
    <meta property="og:description" content="With the 1.6 update finally added jQuery effects to the dropdown menu widget. This version also brought many other features like, auto-recognizing dropdown.css in theme folder, specifiying an external theme URL, options for removing link..." />
<!– End of Facebook Meta Tags –>

 

[See the UPDATE below]

And:

<?php
global $wp_query;
$thePostID = $wp_query->post->ID;
if( has_post_thumbnail( $thePostID )){
    $thumb_id = get_post_thumbnail_id( $thePostID );
    $image = wp_get_attachment_image_src( $thumb_id );
    echo '<meta property="og:image" content="'.$image[0].'" />';
} ?>

 

Pasted into my header? Pssshh… piece of cake.

Actually, I didn’t write it, I got it from shailan.com. I don’t know who this mystery superhero is, but the least they deserve is a link!

So now, when you share something from here, even though I haven’t figured out the excerpt part yet, you’ll at least have a decent thumbnail in the post preview! Whew!

Finally! A Facebook Thumbnail!

 

Now… if I could just get people to share my stuff… but, one victory at a time.

 

UPDATE: My theme creator put out an updated version and now I have no idea how I made that thumbnail thing work. I think I only actually added the second part because the first part just made all my stuff look like it was from the code source site. Blerg! Anyhow, it’s back to working and I’m still trying to get the excerpt to work.

Leave a Comment