Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Open Graph Tags for WordPress
<!-- Twitter Cards -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@site_twitter_username" />
<meta name="twitter:creator" content="@author_twitter_username" />
<meta name="twitter:title" content="<?php echo get_the_title(); ?>" />
<meta name="twitter:description" content="<?php echo get_post_meta( get_the_ID(), 'desc', true);?>" />
<meta name="twitter:image" content="<?php echo get_the_post_thumbnail_url(); ?>" />
<!-- // Facebook -->
<meta property="og:url" content="<?php echo get_permalink(); ?>" />
<meta property="og:type" content="article" />
<meta property="og:title" content="<?php echo get_the_title(); ?>" />
<meta property="og:description" content="<?php echo get_post_meta( get_the_ID(), 'desc', true);?>" />
<meta property="og:image" content="<?php echo get_the_post_thumbnail_url(); ?>" />
<!-- Rich Pins -->
<meta property="og:type" content="article" />
<meta property="og:title" content="<?php echo get_the_title(); ?>" />
<meta property="og:description" content="<?php echo get_post_meta( get_the_ID(), 'desc', true);?>" />
<meta property="og:url" content="<?php echo get_permalink(); ?>" />
<meta property="og:site_name" content="<?php echo get_bloginfo('name'); ?>" />
<meta property="article:published_time" content="<?php echo get_the_date('c'); ?>" />
<meta property="article:author" content="<?php get_the_author_meta('display_name');?>" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment