Skip to content

Instantly share code, notes, and snippets.

@drainpip
Created April 25, 2013 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drainpip/5463712 to your computer and use it in GitHub Desktop.
Save drainpip/5463712 to your computer and use it in GitHub Desktop.
Credit to http://pjrvs.com/ - saving this for later.
<?php if(is_single() || is_page()) { ?>
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="TWITTER_USERNAME">
<meta name="twitter:creator" content="TWITTER_USERNAME">
<meta name="twitter:url" content="<?php the_permalink(); ?>">
<meta name="twitter:title" content="<?php the_title(); ?>">
<meta name="twitter:description" content="<?php the_excerpt_rss(); ?>">
<?php if (has_post_thumbnail()) { ?>
<meta name="twitter:image" content="<?php the_post_thumbnail(); ?>">
<?php } ?>
<meta property="og:type" content="article">
<meta property="og:title" content="<?php the_title(); ?>">
<meta property="og:url" content="<?php the_permalink(); ?>">
<meta property="og:description" content="<?php the_excerpt_rss(); ?>">
<meta property="og:site_name" content="<?php bloginfo('name'); ?>">">
<?php if (has_post_thumbnail()) { ?>
<meta property="og:image" content="<?php the_post_thumbnail(); ?>">
<?php } ?>
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment