Display Latest Tweets on Your WordPress


Sponsored Links






Twitter is phenomenal, almost every internet user have this account, they share everything in Twitter. There are so many method how to display Latest Twitter on your WordPress, we can use display as simple rss, using Twitter Widget or using much advantage method to display twitter. On this Tutorial, I will show you how to display your latest twits with more sophisticated method.

Open your sidebar.php theme (if you want display this tweet on your sidebar) and write this code below

<div class="latest-twit">
<?php
$feedURL = "http://twitter.com/statuses/user_timeline/68559295.rss&quot; // change to your feed URL
$doc = new DOMDocument();
$doc->load($feedURL);
$arrFeeds = array();
foreach ($doc->getElementsByTagName('item') as $node) {
    $itemRSS = array (
        'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
        );
    array_push($arrFeeds, $itemRSS);
}
$limit = 5;
for($x=0;$x<$limit;$x++) {
    $title = str_replace('bavotasan: ', '', $arrFeeds[$x]['title']);
    $str = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href="\0">\0</a>", $title);
    $pattern = '/[#|@][^s]*/';
    preg_match_all($pattern, $str, $matches);

    foreach($matches[0] as $keyword) {
        $keyword = str_replace(")","",$keyword);
        $link = str_replace("#","%23",$keyword);
        $link = str_replace("@","",$keyword);
        if(strstr($keyword,"@")) {
            $search = "<a href="http://twitter.com/$link">$keyword</a>";
        } else {
            $link = urlencode($link);
            $search = "<a href="http://twitter.com/#search?q=$link&quot; class="grey">$keyword</a>";
        }
        $str = str_replace($keyword, $search, $str);
    }
    echo '<li>'.$str.'</li>';
}
?>
</div>

That’s all and you can made some custom on this design by play around with your css skills. Thanks for Batovasan for share this code. If you have better idea how to display latest tweets in WordPress please let’s me know

Subscribe to Full RSS Feed

RSS FeedIf you thing this article useful, please consider subscribing to our RSS Feed or e-mail updates and stay updated with us. You can also follow @WPTricksNet on twitter for latest updates.

About WP Tricks

We are WordPress Family, we collected and writed useful tips and tricks for you WordPress. We share it for you...

Related Tips and Trick from Local Data and on The Net

Tricks: Display Total Twitter Followers as Text on WordPress

Everybody blogging everybody using Twitter for Microbloging tools. On this tips, I will show you how to display your total twitter followers on your sidebar or whatever and displaying as text. All need to do is add little bit code … Read More

How To Display Twitter counter in Text

Update: Better Code Display Twitter Counter Text using WordPress Api Display Twitter Counter in Text is easily in WordPress with PHP code, all need to do just write down some PHP Script in our wordpress theme, we can write it … Read More

The Better Way Display Twitter Followers in Text

There are so many ways to Display Twitter Followers in Text, the popular way is we can use CURL method, we have writen the tutorial display twitter followers in text using CURL. But this method for some WordPress Developers said … Read More

How To Display Custom Content to Search Engine Visitors

There are so many WordPress blog, some of them added unique features, right now I will show you how to display custom content to Search Engine visitors only, You can replace what do you want to be added on Search … Read More

How To Autolink on Twitter Username

Now, everything have twitter account, Website, Actor, Singer, Politican, Webstore, Website, Google, Yahoo and everything on Twitter. We Have too, so follow our Twitter @WPTricksNet For us, Twitter and WordPress is the right couples. So, I will

How To Display Total Retweets in Text without Plugin

Twitter become more popular, now every people and website have twitter account. Using twitter there are unlimited abilites, we can share our favorite post, Retweets others tweets and many more. Today WordPress tutorial will share how to Display Total

Display Latest Tweets on Your WordPress / WordPress Tricks & Tips

Twitter is phenomenal, almost every internet user have this account, they share everything in Twitter. There are so many method how to display Latest Twitter on your read more

Source: http://wptricks.net/display-latest-tweets-on-your-wordpress/

WordPress › Latest tweets « WordPress Plugins

There is a wide choice of widgets which you can put in your WordPress sidebar, but I could not find one that would display a defined number of my latest tweets. read more

Source: http://wordpress.org/extend/plugins/latest-tweets/

Easily display your last Tweet • Yoast

I want to display the latest 3 (or a variable) tweets, in stead of the latest one. Track your WordPress site easily in Google Analytics and add lots of read more

Source: http://yoast.com/display-latest-tweet/

Display your latest tweet on a Wordpress blog - SamSpencer.com

This article is just a quick explanation of how to display your latest tweets on a WordPress blog without any plugins. This will be accomplished by using a RSS feed that read more

Source: http://samspencer.com/?p=595

Display Latest Tweet with Show/Hide Cookies | Perishable Press

display your latest tweet and WordPress. Here is a Demo of the finished product. Overview. Once implemented, this technique will display your latest tweet hide latest tweets read more

Source: http://perishablepress.com/display-latest-tweet/


11 Responses to Display Latest Tweets on Your WordPress

  1. bolaji says:

    i need latest entertainment update on my blog mostly naija update.

  2. Pingback: Added Latest Tweets in WordPress Sidebar « E-Book Live

  3. Pingback: Tweets that mention Display Latest Tweets on Your WordPress # WordPress Tricks & Tips -- Topsy.com

  4. aljuk says:

    It’s not working for me. Copied and pasted exactly, simply changed the feed data to my feed.

    Parse error: syntax error, unexpected T_VARIABLE

    • claire says:

      Hi,
      You’ve probably figured this out already by now but just ad a semi colon after your feed like

      $feedURL = “http://twitter.com/statuses/user_timeline/68559295.rss”;

      It’s just missing from the example.

  5. rys says:

    to those who made a blog in a hard coded you can also refer to this site on how to display your latest tweets in twitter. with twitter API.
    as easy as 1 2 3..

    http://www.ryscript.co.cc/web/how-to-display-latest-tweets-using-javascript-and-twitter-api/

    thanks..

  6. Thank you for the twitter code. I was wondering is there a PHP code that will show the visitor tweeted posts from your blog ?

    that would be a good reward for visitors to tweet your posts.

    thank you for sharing.

  7. bioflava says:

    Hi,

    I was wondering how to add the @ in front of the tweet account name and make the @username clickable. I can’t seem to figure it out.

    Thanks!

    • bioflava says:

      To clarify, right now I have this:

      joshuaiz: RT @jeremythegirl: Friday and Saturday night at The Downtown Comedy Club. Shows start at 9pm. Where are you going to be?

      I would like the “joshuaiz” above with the @ sign and clickable.

      Thanks!

  8. Thanks. I do appreciate it. All I wanted to do was display a single Twitter feed in my header… I’ve been sorting through pages and pages of plugins and they all do way more than I need or want. So I appreciate this.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>