Return to Snippet

Revision: 31289
at September 2, 2010 08:52 by richerimage


Initial Code
<?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("<content type=\"html\">", $feed);
    $stepTwo = explode("</content>", $stepOne[1]);
    $tweet = $stepTwo[0];
    $tweet = str_replace("&lt;", "<", $tweet);
    $tweet = str_replace("&gt;", ">", $tweet);
    return $tweet;
    }

    $twitterFeed = file_get_contents($feed);
    echo stripslashes($prefix) . parse_feed($twitterFeed) . stripslashes($suffix);
    ?>

Initial URL

                                

Initial Description

                                

Initial Title
Display your latrest tweets in wordpress

Initial Tags
wordpress, twitter

Initial Language
PHP