Skip to content

Instantly share code, notes, and snippets.

@szabcsee
Created March 14, 2013 12:19
Show Gist options
  • Save szabcsee/5160911 to your computer and use it in GitHub Desktop.
Save szabcsee/5160911 to your computer and use it in GitHub Desktop.
Set <og:image> for Facebook in Wordpress blogs. Place it in the header
<?php if (is_single()){
$facebookimage = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
<meta property="og:image" content="<?php echo $facebookimage[0];?>"/>
<?php }; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment