Twitter is one of the best tools that you can use as a blogger to promote your blog posts. Many blogs (including this one) uses Twitter related widgets and badges where you can display Tweets. If you would like to display your most recent Tweet on your WordPress website or blog without a plugin, use the code below anywhere in your theme where you would like to display the tweet.
You can see this in action right here on this blog at the top where I display my most recent tweet with a link back to my Twitter Profile.
Display your most recent tweet
{code type=”PHP”}
php
$username = “TwitterUsername”; // Your twitter username.
$prefix = “”; // Prefix – some text you want displayed before your latest tweet.
$suffix = “”; // Suffix – some text you want display after your latest tweet.
$feed = “http://search.twitter.com/search.atom?q=from:” . $username . “&rpp=1”;
function parse_feed($feed) {
$stepOne = explode(“”, $feed);
$stepTwo = explode(“”, $stepOne[1]);
$tweet = $stepTwo[0];
$tweet = str_replace(“<”, “<“, $tweet);
$tweet = str_replace(“>”, “>”, $tweet);
return $tweet;
}
$twitterFeed = file_get_contents($feed);
echo stripslashes($prefix) . parse_feed($twitterFeed) . stripslashes($suffix);
?>
{/code}
NB: Remove TwitterUsername with your own username.
Glad I could help.