Created
April 24, 2013 18:41
-
-
Save TheHeat/5454460 to your computer and use it in GitHub Desktop.
Fire WordPress post info into a Twitter summary card.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function heat_twitter_card(){ | |
$title = get_post_meta(get_queried_object_id(), 'Title', true); | |
$description = get_post_meta(get_queried_object_id(), 'Description', true); | |
$image = get_the_image(array('format'=>'array')); ?> | |
<!--Twitter Card--> | |
<meta name="twitter:card" content="summary"> | |
<meta name="twitter:site" content="@marcheatley"> | |
<meta name="twitter:title" content="<?php echo $title; ?>"> | |
<meta name="twitter:description" content="<?php echo $description; ?>"> | |
<meta name="twitter:creator" content="@marcheatley"> | |
<meta name="twitter:image:src" content="<?php echo $image[url]; ?>"> | |
<?php } | |
add_action( 'wp_head', 'heat_twitter_card' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment