Archive for May, 2011

WordPress – Addthis facebook image – Automatically uses your featured image when you share on Addthis

Addthis does not allow you to choose a thumbnail when you share with facebook. This little snippit automatically selects your featured image and uses it when anyone uses addthis to share.

Simply paste the following just after the <head> tag in your header.php file in your wp-content > themes > yourcurrentthemename

<?php if (has_post_thumbnail( $post->ID ) ): ?>
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘single-post-thumbnail’ ); ?>
<meta property=”og:image” content=”<?php echo $image[0];?>”/>
<?php endif; ?>

I’m on wordpress 3.1.1 and this does the trick for one of my blogs where this is essential. I hope that it helps you guys.

RSS Feed Add to Del.cio.us Add to Technorati Favorites Stumble It! Digg It!
    

Post to Twitter