Hello,
I’m attempting to add Twitter Cards functionality to client site using Movable Type. Anyone have a solution for that CMS? Saw the php hack and wondering if anyone else had worked with that yet? If so, am I going in the right direction here…
<?php
#twitter cards hack
if(is_single() || is_page()) {
$twitter_url = <$mt:EntryPermalink$>;
$twitter_title = <$mt:EntryTitle$>;
$twitter_desc = <$mt:EntryBody$>;
$twitter_thumbs = ;
$twitter_thumb = $twitter_thumbs[0];
if(!$twitter_thumb) {
$twitter_thumb = '';
}
$twitter_name = str_replace('@', '', get_the_author_meta('twitter'));
?>
<meta name="twitter:card" value="summary" />
<meta name="twitter:url" value="<?php echo $twitter_url; ?>" />
<meta name="twitter:title" value="<?php echo $twitter_title; ?>" />
<meta name="twitter:description" value="<?php echo $twitter_desc; ?>" />
<meta name="twitter:image" value="<?php echo $twitter_thumb; ?>" />
<meta name="twitter:site" value="@twitter_name" />
<?
if($twitter_name) {
?>
<meta name="twitter:creator" value="@<?php echo $twitter_name; ?>" />
<?
}
}
?>
Is there a better way? Open to suggestions.
Thank you.
Brian